JSON Deserialize ( NewtonSoft JSON.NET) to XML Failure -
i have no experience json @ all, unfortunately have webservice returns data me. need format data json xml can import our own system here.
i receive data web service in format:
{ "httpstatuscode": 200, "messages": [], "succesfulresponses": [ { "position": 0, "response": { "dln": "aaapy459037vb9sv", "dvlaserviceversion": "1", "hubserviceversion": "1.0.0.0", "dvlaprocessingdate": "2014-12-22t14:03:43.557z", "hubprocessingdate": "2015-05-29t16:50:51.4364004+01:00", "licence": { "status": "fc", "validfrom": "1986-01-22", "validto": "2017-09-02", "directiveindicator": 0, "entitlements": [ { "code": "a", "validfrom": null, "validto": null, "priorto": false, "type": "f", "restrictions": [] } ], "endorsements": [] }, "httpstatuscode": 200, } "messages": [] } ], "errorresponses": [] }
i tried use following using newtonsoft json.net program:
dim doc xmldocument = directcast(jsonconvert.deserializexmlnode(sanswer, "root"), xmldocument)
unfortunately returned this:
2000aaapy459037vb9sv11.0.0.02014-12-22t14:03:43.557z2015-05-29t16:59:08.6833762+01:00fc1986-01-222017-09-020afalsef200
which of no use me @ all, need format xml complete node name / elements can import correctly, able point me in right direction?
cheers,
j
managed format json xml correctly. added following returned json string:
json = "{" & vbcr & vblf & " '?xml': {" & vbcr & vblf & " '@version': '1.0'," & vbcr & vblf & " '@standalone': 'no'" & vbcr & vblf & " }," & vbcr & vblf & " 'root': " + sanswer
then specified deserialize 'root'
Comments
Post a Comment