I am using JsonConvert.SerializeXmlNode() to serialize a xml node:
var doc = new XmlDocument();
doc.LoadXml(xml.ToString());
jsonRequest = JsonConvert.SerializeXmlNode(doc);
here is an example xml array
<cars>
<car>
<id>0001</id>
</car>
<car>
<id>0002</id>
</car>
</cars>
this would become:
{
"cars" : {
"car" : [{
"carId" : "0001"
}, {
"carId" : "0002"
}]
}
}
Is there a way to serialize the array like this?
{
"cars" : [{
"carId" : "0001"
}, {
"carId" : "0002"
}
]
}