问题
I am using JSON.NET and I want to convert from XML to JSON.
I am using JsonConvert.SerializeXNode(node) and I noticed that my json object has properties with @ in front of their names:
So for example: If I have:
<channel id="999" name="XXX" sid="8294" type="Digital TV" />
the JSON object is:
{ "@id": "999", @name="XXX" etc
Why am I getting "@" inserted in the JSON and is there a way I can avoid the "@" character being inserted?
回答1:
I think thats just the way json.net works regarding the @ signs. You can always run a regex on the json string and replace them. Theres an example here
来源:https://stackoverflow.com/questions/11017448/json-net-has-in-the-attribute-names