This conversion is actually very simple. The most important thing is to reference the class library first. You can go to the official website to download reference http://json.codeplex.com.
Two days ago I learned Jquery ajax submit Json background processing article link for http://www.cnblogs.com/aehyok/archive/2013/05/18/3085499.html
Xml =;
This is an xml string pre-defined in the Code.
XmlDocument doc =
Then, read the xml string into the XML document.
JsonText =
Then, use the method specified in the Json. Net class library for conversion.
The running result is:
Json string in the first format
Json =;
The predefined Json string is as follows:
Similarly, the method in the Json. Net class library is called.
XmlDocument doc1 =
Json string in the second format
Json_str = json1 = + json_str +;
Call in the same way
XmlDocument doc2 =
Result:
The call is very simple. As long as the passed XML or Json string format is correct, it is not difficult to get the desired result. The code can be copied directly.