Reputation: 181
I have XML payloads in blob storage and am looking for the best way to parse this into classes in C#. I want to be able to parse the XML in an API and return json objects based on the XML payload however, I am unsure the best approach to start this.
How would I go about doing this?
Upvotes: 0
Views: 303
Reputation: 2566
class cXMLJsonNode : Dictionary<string,object>
{
}
to create custom built JSON object:
JsonConvert.SerializeObject(new cXMLJsonNode {
{ key1, value1 },
{ key2, value2 },
{ property1, new cXMLJsonNode {
{ key1, oldValue1 }
{ key2, oldValue1 }
},
{ property2, new cXMLJsonNode {
{ key1, newValue1 }
{ key2, new cXMLJsonNode {
{ key1, newValue1 }
{ key2, newValue2 }
}
},
})
Upvotes: 1