我想從json結構中獲取特定鍵的特定json值。我曾嘗試以下:如何從json嵌套結構中獲取鍵的json值?
var jsonstring;
jsonstring = JSON.stringify(myjsonObjectArray);
alert(jsonstring);//giving the below json structure
jsonstring = [{
"key01": [10, "Key01 Description"],
"key02": [false, "It's a false value"],
"key03": [null, "Testing Null"],
"key04": ["tests", "Another Test Value"],
"key05": [
[25, 50], "Some testing values"
]
}, {
"key10": [100, "Key10 Value"],
"key11": [true, "It's a true value for key11"],
"key12": [null, "key12 values is Null"],
"key13": ["Testing", "Another Test Value for key13"],
"key14": [
[10, 20], "Some other testing values"
],
"key15": ["Test Name", "Name of the key15"]
}]
,但我需要一個像結構如下:
jsonstring = [{
"key01": 10,
"key02": false,
"key03": null,
"key04": "tests",
"key05": [25, 50]
}, {
"key10": 100,
"key11": true,
"key12": null,
"key13": "Testing",
"key14": [10, 20],
"key15": "Test Name"
}]
我怎樣才能像上述結構(意味着我只需要單個值,不需要第二個值/結構中各個鍵的多個值)?請幫助我,並提前致謝。
這不是CoffeeScript的;) – Markus