Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON.net has @ in the attribute names?

Tags:

json

json.net

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?

like image 510
JD. Avatar asked Nov 04 '22 22:11

JD.


1 Answers

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

like image 142
gdp Avatar answered Nov 15 '22 08:11

gdp