Click here to Skip to main content
15,894,180 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,all


Does anyone know how to create a xml file based on a json string returned from webservice.

Let's say the return string from webservice is json frommat. It's in dicionary type and for the

dictionary key "xmlString", i want to create a xml file based on the value from this dictionary

key "xmlString". I have tried JsonConvert.DeserializeXmlNode and get some error.


Any help would really appreciated
Posted

1 solution

If you get an error, tell us what it is. A JSON library should turn JSON in to a class. You should be able to create XML from there.
 
Share this answer
 
Comments
codingStar 18-Jun-13 0:26am    
<site><Properties><Property id="site.version" value="1.0" /><Property id="movex.version" value="10.0" /><Property id="webservice.date.format" value="yyyyMMdd" /><Property id="display.format" value="dd-MM-yy" /></Properties>

hi ,christian,the above is the Text Visualizer from visual studio for the json string i retrieved from webservice, i am trying to create a xml file based on this string . could you give me some idea or code about how to achieve this ,please

the code i am trying to use is below:
var m= JsonConvert.DeserializeXmlNode(configXmlStr);
i got some error shows Unexpected character encountered while parsing value: <. Line 1, position 1.
thanks
Christian Graus 18-Jun-13 0:28am    
Then your JSON string is not in the format it expects. Your string is XML, JSON is not XML.
codingStar 18-Jun-13 0:34am    
hi,christian

so does that mean i just save this string to a file.
Christian Graus 18-Jun-13 0:34am    
If you like. It is XML.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900