c# - Json.Net Serialize Complex Object to Xml Attribute And Value -


let's have json object looks this:

{     "phones": [         {             "phone": {                 "value": 123,                 "@type": "foo"             }         }     ] } 

i want call jsonconvert.deserializexmlnode() resulting xml this:

<phones>     <phone type="foo">123</phone> </phones> 

currently value being deserialized xml element child of phone, want xml value of phone. there way using json.net, special operator tells deserialize such, without having create custom serializer? apppreciated.

i figured out. using

"phone": {       "@type": "foo",       "#text": 123  } 

gives me expected result. #text tells not create child element value.


Comments

Popular posts from this blog

java - unable show chart in xls document using jasper reports -

java.lang.RuntimeException: Could not generate dummy secret at sun.security.ssl.RSAClientKeyExchange.<init> -

javascript - How to change image src on success AJAX -