http://stackoverflow.com/questions/36060539/convert-json-array-to-xml

CSharp · Console

/Program.cs

using System;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using Newtonsoft.Json.Linq;
					
public class Program
{
	public static void Main()
	{
            string jsonResult = @"
            [
              {
                ""car"": {
                  ""features"": [
                    {
                      ""code"": ""1""
                    },
                    {
                      ""code"": ""2""
                    }
                  ]
                }
              },
              {
                ""car"": {
                  ""features"": [
                    {
                      ""code"": ""3""
                    },
                    {
                      ""code"": ""2""
                    }
                  ]
                }
              }
            ]";

            var ja = JArray.Parse(jsonResult);
            var xml = new XDocument(
                new XElement("cars", 
                    ja.Select(c => 
                        new XElement("car",
                            new XElement("features", 
                                c["car"]["features"].Select(f => 
                                    new XElement("feature", 
                                        new XElement("code", (string)f["code"])
                                    )
                                )
                            )
                        )
                    )
                )
            );

            Console.WriteLine(xml.ToString());
	}
}
;