I am trying to convert dataset to JSON in .net core 2.0 and am using the below code to do that
return Ok(JsonConvert.SerializeObject(dataset, Formatting.Indented))
and the output I am getting is
"{\n \"DataSet.RemotingVersion\": {\n \"Major\": 2,\n \"Minor\": 0,\n \"Build\": -1,\n \"Revision\": -1,\n \"MajorRevision\": -1,\n \"MinorRevision\": -1\n },\n \"XmlSchema\": \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-16\\\"?>\\n<xs:schema id=\\\"dataset\\\" xmlns=\\\"\\\" xmlns:xs=\\\"http://www.w3.org/2001/XMLSchema\\\" xmlns:msdata=\\\"urn:schemas-microsoft-com:xml-msdata\\\">\\n <xs:element name=\\\"dataset\\\" msdata:IsDataSet=\\\"true\\\" msdata:UseCurrentLocale=\\\"true\\\">\\n <xs:complexType>\\n <xs:choice minOccurs=\\\"0\\\" maxOccurs=\\\"unbounded\\\">\\n <xs:element name=\\\"datatable\\\">\\n <xs:complexType>\\n <xs:sequence>\\n <xs:element name=\\\"cvbf\\\" type=\\\"xs:string\\\" msdata:targetNamespace=\\\"\\\" minOccurs=\\\"0\\\" />\\n </xs:sequence>\\n </xs:complexType>\\n </xs:element>\\n </xs:choice>\\n </xs:complexType>\\n </xs:element>\\n</xs:schema>\",\n \"XmlDiffGram\": \"<diffgr:diffgram xmlns:msdata=\\\"urn:schemas-microsoft-com:xml-msdata\\\" xmlns:diffgr=\\\"urn:schemas-microsoft-com:xml-diffgram-v1\\\" />\"\n}"
Am pretty new to C# development,
- How to convert it into proper JSON?
- and Why is it appearing like this?