Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>After using toJSON(), you could use this to convert JSON to XML, from <a href="http://goessner.net/2006/06/converting-between-xml-and-json-xmlcom.html" rel="nofollow noreferrer">goessner.net</a> (<a href="http://goessner.net/download/prj/jsonxml/json2xml.js" rel="nofollow noreferrer">source file</a>):</p> <pre><code>/* This work is licensed under Creative Commons GNU LGPL License. License: http://creativecommons.org/licenses/LGPL/2.1/ Version: 0.9 Author: Stefan Goessner/2006 Web: http://goessner.net/ */ function json2xml(o, tab) { var toXml = function(v, name, ind) { var xml = ""; if (v instanceof Array) { for (var i=0, n=v.length; i&lt;n; i++) xml += ind + toXml(v[i], name, ind+"\t") + "\n"; } else if (typeof(v) == "object") { var hasChild = false; xml += ind + "&lt;" + name; for (var m in v) { if (m.charAt(0) == "@") xml += " " + m.substr(1) + "=\"" + v[m].toString() + "\""; else hasChild = true; } xml += hasChild ? "&gt;" : "/&gt;"; if (hasChild) { for (var m in v) { if (m == "#text") xml += v[m]; else if (m == "#cdata") xml += "&lt;![CDATA[" + v[m] + "]]&gt;"; else if (m.charAt(0) != "@") xml += toXml(v[m], m, ind+"\t"); } xml += (xml.charAt(xml.length-1)=="\n"?ind:"") + "&lt;/" + name + "&gt;"; } } else { xml += ind + "&lt;" + name + "&gt;" + v.toString() + "&lt;/" + name + "&gt;"; } return xml; }, xml=""; for (var m in o) xml += toXml(o[m], m, ""); return tab ? xml.replace(/\t/g, tab) : xml.replace(/\t|\n/g, ""); } </code></pre> <p>That said, I'd personally go for JSON.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload