5

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

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for that. I wasn't sure if I was doing something wrong.
if you know that that's the only place the @ signs will show up in the json, string.replace works much faster or bigger documents

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.