json formating in c# -
i tring xml data convert json. got issue.
string xml = "<test><name>test class</name><x>100</x><y>200</y></test>"; xmldocument doc = new xmldocument(); doc.loadxml(xml); return newtonsoft.json.jsonconvert.serializexmlnode(doc);
when display datavisualizer
{"test":{"name":"test class","x":"100","y":"200"}}
but page return
"{\"test\":{\"name\":\"test class\",\"x\":\"100\",\"y\":\"200\"}}"
it not valid json.
how format ?
what happening passing json string client, @ client if give datatype "json" again serialize string , above result.
fact not invalid json actually, need parse json object
at client side...using javascript
var jsonobject = json.parse("{\"test\":{\"name\":\"test class\",\"x\":\"100\",\"y\":\"200\"}}");
Comments
Post a Comment