开发者

Jquery JSON parsing with @id:

I have the foll开发者_JAVA百科owing 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


Try:

json['@id']

Also note that the JSON object you've posted is not valid: you are missing a , between the two properties.


In addition to above answer, you can use http://jsonlint.com to validate your json

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜