Javascript 有人能告诉我如何在jsp中迭代和使用json映射数组吗?

Javascript 有人能告诉我如何在jsp中迭代和使用json映射数组吗?,javascript,jquery,json,jsp,jstl,Javascript,Jquery,Json,Jsp,Jstl,我的javascript中有json数据(映射数组),如下所示: [ {"HOURLY":"$309.75","Airport Fee":"$15.00","STC":"$52.66","Gratuity":"$61.95","Fuel Surcharge":"$5.00"}, {"HOURLY":"$309.75","Airport Fee":"$15.00","STC":"$52.66","Gratuity":"$61.95","Fuel Surcharge":"$5.00"} ] 我想使

我的javascript中有json数据(映射数组),如下所示:

[
{"HOURLY":"$309.75","Airport Fee":"$15.00","STC":"$52.66","Gratuity":"$61.95","Fuel Surcharge":"$5.00"},
{"HOURLY":"$309.75","Airport Fee":"$15.00","STC":"$52.66","Gratuity":"$61.95","Fuel Surcharge":"$5.00"}
]

我想使用一些
object.value
map.getValueBykey
机制来使用jsp中一个映射的值,就像我们使用从java传递到jsp的模型对象一样。

看到有一个对象数组,首先将其视为数组。所以

prices = [
  {"HOURLY":"$309.75","Airport Fee":"$15.00","STC":"$52.66","Gratuity":"$61.95","Fuel Surcharge":"$5.00"},
  {"HOURLY":"$329.75","Airport Fee":"$15.00","STC":"$52.66","Gratuity":"$61.95","Fuel Surcharge":"$5.00"}
];

console.log(prices[0].HOURLY); // will output "$309.75", value found in the first object
console.log(prices[1].HOURLY); // will output "$329.75", value found in the second object

// If you want to get all values of that one property in all objects in the array, you can iterate like this:
for(var i =0;i <prices.length;i++){
  console.log( prices[i].HOURLY);
}

// If you want to get all values for each property in a specific object, for example the first one in the array, you can iterate like this :
for(key in prices[0]){
  console.log("'" +key + "' = " + prices[0][key]);
}
价格=[
{“每小时”:“309.75美元”,“机场费”:“15.00美元”,“STC”:“52.66美元”,“小费”:“61.95美元”,“燃油附加费”:“5.00美元”},
{“每小时”:“$329.75”,“机场费”:“$15.00”,“STC”:“$52.66”,“小费”:“$61.95”,“燃油附加费”:“$5.00”}
];
console.log(价格[0]。每小时);//将输出在第一个对象中找到的值“$309.75”
console.log(价格[1]。每小时);//将输出第二个对象中的值“$329.75”
//如果要在数组中的所有对象中获取该属性的所有值,可以如下迭代:
对于(var i=0;i