I create simple c# code to convert json to xml but there is an issue. Check the result that miss xml header(version and encoding)
string json = "{\"name\":\"JSON\",\"integer\":1,\"double\":2.0,\"boolean\":true,\"nested\":{\"id\":42},\"array\":[1,2,3]}";
XmlDocument doc = (XmlDocument) Newtonsoft.Json.JsonConvert.DeserializeXmlNode(json, "root", true);
string xmlString = doc.InnerXml;
Console.log(xmlString);
Result
<root><name>JSON</name><integer>1</integer><double>2</double><boolean>true</boolean><nested><id>42</id></nested><array>1</array><array>2</array><array>3</array></root>