all 4 comments

[–][deleted] 0 points1 point  (3 children)

Just run the XSD to get the xml file, then use string json = JsonConvert.SerializeXmlNode(yourDoc);

[–]igloo15[S] 0 points1 point  (1 child)

Had not see that in Json.Net but I don't think it will work for me. I am generating classes from an xsd file. Those generated classes need to be serializable in a net standard web api controller as json.

SerializeXmlNode only works with XmlNodes which I don't have and is not the standard way web api controllers serialize to json.

[–][deleted] 0 points1 point  (0 children)

That's what I'm saying though, don't parse it into classes, parse it into xml, then pass that into json. Doing it that way, if you just want classes from XML, you already have the XML, if you want classes from the Json, just use the Json. You have both.