Convert JSON to XML .net
I want to convert from JSON to XML but the return keep showing in JSON. No Error or bug
protected string convertToJSONorXML(object convertThisObj, returnDataFormat returnFormat, bool jsonformatting = false)
{
string returnString = "";
if (returnFormat == returnDataFormat.JsonFormat)
{
return JsonConvert.SerializeObject(convertThisObj,
(jsonformatting) ? Formatting.Indented : Formatting.None,
new JsonSerializerSettings { NullValueHandling = (jsonformatting) ? NullValueHandling.Ignore : NullValueHandling.Include }
);
}
returnString = toXML(convertThisObj);
return returnString;
}
Read more here: Source link
