I've recently used JSON and XML to convert from one POC project to another, although I know that many libraries like json.net have this functionality, but I've been using spider Studio to quickly implement this feature with an online tool site.
Online Tools Website: Http://www.utilities-online.info/xmltojson
Prerequisites: Spider Studio (Acquisition workstation): http://www.gdtsearch.com/products.spiderstudio.htm
1. Open spider Studio, load page http://www.utilities-online.info/xmltojson/
2. Select the page element feature to find the XML and JSON two input boxes and two mutually convertible buttons, their IDs are: #json, #xml, #tojson, #toxml.
3. Scripting automatically completes page operations:
public void Run ()
{
logger.clearall ();
Logger.Log (Xml2json ("<person><name>Mike</name><age>30</age></person>"));
Logger.Log (Json2xml ("{' person ': {' name ': ' Mike ', ' Age ':}}");
}
public string Xml2json (string xml)
{
lock (this)
{
default.navigate ("http:// Www.utilities-online.info/xmltojson ");
Default.ready ();
Default.selectsinglenode ("#xml"). Text (XML);
Default.selectsinglenode ("#tojson"). Click ();
var json = Default.selectsinglenode ("#json"). Text ();
return JSON;
}
}
public string Json2xml (string json)
{
lock (this)
{
default.navigate ("http:// Www.utilities-online.info/xmltojson ");
Default.ready ();
Default.selectsinglenode ("#json"). Text (JSON);
Default.selectsinglenode ("#toxml"). Click ();
var xml = Default.selectsinglenode ("#xml"). Text ();
return XML;
}
}
Test effect: