0

I know how to do this but what I don't know is how I handle JSON like this:

[{ "player": { "id": 1, "name": "Name", "contact": { "tel": "123456789", "nick_name": "NickName" }, "achievments": { "achievment1": "Achievment", "achievment2": "Achievment" } } }] 

"contact" and "achievments" have subinfo. How do I handle this?

 XDocument xmlDocument = new XDocument(new XDeclaration("1.0", "utf-8", "yes"), new XElement("Players", from player in PlayerList select new XElement("player", new XElement("id", player.Id), new XElement("name", player.Name)))); 
2
  • Do you want to convert JSON to XML or what's the problem? Commented Feb 12, 2015 at 12:59
  • Well in my code i write the JSON data into "PlayerList" and the value of that list i want to write out into a local XML file. Commented Feb 12, 2015 at 13:03

1 Answer 1

1

Consider using Json.net?

It has methods for converting directly from Json to xml, and does parsing very well too. Check out this question for more

Sign up to request clarification or add additional context in comments.

1 Comment

Yes ok, but i can't use "DeserializeXmlNode".