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))));
alexwlchan
  • 5,699
  • 7
  • 38
  • 49

1 Answers1

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

Community
  • 1
  • 1
Raptor
  • 103
  • 8