Functions
fromJson | I Converts a JSON object to an XML representation. |
toJson | I Converts an XML object to its JSON representation. |
fromJson
function fromJson(json jsonValue, JsonOptions options) returns xml? | Error
Isolated Function
Converts a JSON object to an XML representation.
1json data = {2 name: "John",3 age: 304};5xml? xmlValue = check xmldata:fromJson(data);
Parameters
- jsonValue json
The JSON source to be converted to XML
- options JsonOptions (default {})
The xmldata:xmldata:JsonOptions
record for JSON to XML conversion properties
toJson
function toJson(xml xmlValue, XmlOptions options) returns json | Error
Isolated Function
Converts an XML object to its JSON representation.
1xml xmlValue = xml `<!-- outer comment -->` + xml `<name>supun</name>`;2json jsonValue = check toJson(xmlValue);
Parameters
- xmlValue xml
The XML source to be converted to JSON
- options XmlOptions (default {})
The xmldata:XmlOptions
record consisting of the configurations for the conversion
Return Type
(json | Error)The JSON representation of the given XML on success, else returns an xmldata:Error