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

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -