我有一个从服务器返回的JSON值。我可以解析这个值。找到以下JSON值
{"Result":{"d8bf6ab7-21a2-4964-a2cf-e7a1db097f08_FROM":"FROM"}}
如果我试图获得像
这样的值console.log(Result.d8bf6ab7-21a2-4964-a2cf-e7a1db097f08_FROM);
console.log(Result[d8bf6ab7-21a2-4964-a2cf-e7a1db097f08_FROM]);
抛出错误
SyntaxError: identifier starts immediately after numeric literal
答案 0 :(得分:1)
试试这个:
var obj = {"Result":{"d8bf6ab7-21a2-4964-a2cf-e7a1db097f08_FROM":"FROM"}};
console.log(obj.Result["d8bf6ab7-21a2-4964-a2cf-e7a1db097f08_FROM"]);