Reputation: 1255
I have the following JSON:
{
"@id": "hey there",
"id": "hey there 2"
}
I can easily parse "id"
with json.id
but how can I get the value of "@id"
using jquery's inbuilt JSON parser?
As calling "json.@id"
is not correct.
Thanks
Upvotes: 2
Views: 1695
Reputation: 78667
In addition to above answer, you can use http://jsonlint.com to validate your json
Upvotes: 2
Reputation: 1038930
Try:
json['@id']
Also note that the JSON object you've posted is not valid: you are missing a ,
between the two properties.
Upvotes: 4