When I am converting JSON Values to XML, instead of getting JSON properties as elements of XML, I am receiving
"title":"source"
. The desired output should be <title>source</title>
. Can you help me identify what mistake I might be making? This code is written in JavaScript.
I am utilizing the x2js plugin for conversion and have included it using a script tag.
The code snippet used for converting dynatree to JSON and then JSON to XML is shown below:
var x2js = new X2JS();
var tree = $("#source").dynatree("getTree").toDict();
alert(" tree:"+tree);
var jsonObject = JSON.stringify(tree); //Convert dynatree to JSON
alert("jsonObject: "+jsonObject);
var xmlAsStr = x2js.json2xml_str(jsonObject); //Convert JSON to XML
alert("xml: "+xmlAsStr);