public void Run()
{
Logger.ClearAll();
Logger.Log(Xml2Json("<person><name>Mike</name><age>30</age></person>"));
Logger.Log(Json2Xml("{'person':{'name':'Mike', 'age':30}}"));
}
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;
}
}