use*_*540 3 javascript jquery json
我有一个 json 字符串。我想使用字段名称从该字符串中获取值。请帮我得到这个。这是我的 json 字符串格式。
[
{
"FLD_ID": 1,
"FLD_DATE": "17-02-2014 04:57:19 PM"
"FLD_USER_NAME": "DAFEDA",
"FLD_USER_EMAIL": "test@gmail.com",
"FLD_USER_PASS": "test"
}
]
Run Code Online (Sandbox Code Playgroud)
我不太确定问题是什么,但是怎么样
// assuming str is your JSON string
var obj = JSON.parse(str); // parse the string into an object
var firstObj = obj[0]; // get the first (and only) object out of the array
var fld_id = firstObj.FLD_ID; // you can access properties by name like this
var fld_date = firstObj['FLD_DATE']; // or like this
Run Code Online (Sandbox Code Playgroud)