Functions - xmlutils

fromJSON
Converts a JSON object to an XML representation.

fromJSON

(json? jsonValue, JsonOptions options)

returns xml | error
Converts a JSON object to an XML representation.
 json data = {
     name: "John",
     age: 30
 };
 xml|error xmlValue = xmlutils:fromJSON(data);

Parameters

  • jsonValue json?
  • The JSON source

  • options JsonOptions (default ballerina/xmlutils:JsonOptions $mapping$var$0 = {})
  • The xmlutils:JsonOptions record for JSON to XML conversion properties

  • Return Type

    (xml | error)
  • XML representation of the given JSON if the JSON is successfully converted or else an error