c# - XML to JSON Conversion seems to add extra backslashes -


i trying convert xml document json using newtonsoft jsonconvert.serializexmlnode.

string json = jsonconvert.serializexmlnode(xmldoc); return json; 

xmldoc.innerxml contains

<?xml version=\"1.0\" encoding=\"utf-8\"?><fql_query_response xmlns=\"http://api.facebook.com/1.0/\" xmlns:xsi=\"http://www.w3.org/2001/xmlschema-instance\" list=\"true\"><stream_post><message>tyck till om kampanjen!\r\n\r\n 

when conversion escape characters added.

{\"?xml\":{\"@version\":\"1.0\",\"@encoding\":\"utf-8\"},\"fql_query_response\":{\"@xmlns\":\"http://api.facebook.com/1.0/\",\"@xmlns:xsi\":\"http://www.w3.org/2001/xmlschema-instance\",\"@list\":\"true\",  {\"message\":\"tyck till om kampanjen!\\r\\n\\r\\n 

why happen, , can prevent it? remove characters seems there setting i'm missing or something.

regards, david

i had same problem java days ago. because stringifing stringified json. mean doing like:

(javascript) var str = json.stringify(data); return json.stringify(str); 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -