以下是从文本文件中读取并存储在变量中的json元素。即。
sCurrentLine = {
"description": "Update gclient to handle when a DEPS file has no deps dictionary.\n\nCommitted: http://src.chromium.org/viewvc/chrome?view=rev&revision=1652",
"cc": [],
"reviewers": [
"nils.juenemann@gmail.com"
],
"owner_email": "sguireknight@gmail.com",
"private": false,
"base_url": "svn://chrome-svn.corp.google.com/chrome/trunk/depot_tools/",
"owner": "sguireknight",
"subject": "Handle when a DEPS file has no deps dictionary.",
"created": "2008-09-02 20:11:04.145884",
"patchsets": [
1
],
"modified": "2011-05-09 13:10:20.276741",
"closed": true,
"commit": false,
"issue": 201
}
我想访问问题值201.我该怎么做?
答案 0 :(得分:1)
如果你正在使用Javascript(你没有指定),你可以通过这样做来访问该值:
sCurrentLine.issue
就是这样。
答案 1 :(得分:0)
为了完整起见,还有另一种方法可以在javascript中访问它
sCurrentLine["issue"]