I have an azure function (c#) that is taking an xml file and converting it to json. I need the json to be in a very particular format so I am taking the xml elements and putting them into .Net class objects so they can be converted.
public class genericName
{
string time;
string id;
string otherId;
string name;
Class[] exampleClass;
Class[] exampleClass2;
}
The structure of the class looks like this, where the two lists are comprised of other class objects. Trying to use the built in newtonsoft JsonConvert.SerializeObject on this class object just results in empty brackets.
The nested classes look like this
exampleClass
{
string id;
string ID;
string Status;
string example;
Class[] exampleClass;
Class[] exampleClass2;
Class[] exampleClass3;
}
I know that I probably need to override the json converter writejson method. But I am not really sure how to do that in this case.
If anyone could point me to a resource that may help or give an example of something similar.
Thanks in advance!
CodePudding user response:
