var test = {"99":{"ttop":"0","lleft":"0","wwidth":"881","hheight":"78"},
"42":{"ttop":"91","lleft":"110","wwidth":"285","hheight":"26"},
"43":{"ttop":"91","lleft":"490","wwidth":"117","hheight":"26"},
"44":{"ttop":"91","lleft":"5","wwidth":"87","hheight":"26"},
"36":{"ttop":"91","lleft":"630","wwidth":"251","hheight":"26"}}
我已经阅读了很多关于使用文本标识符访问的内容(例如“first-id”而不是“99”)但我认为我的问题是当我使用id作为id时出错。
非常感谢您的帮助
答案 0 :(得分:1)
您需要使用bracket notation代替dot notation作为member operator
test['99']
答案 1 :(得分:1)
当属性名称不是有效标识符时,请使用数组语法来访问它:
test["99"]