我正在学习这笔交易,并想知道如何正确显示JSON数据。
我有以下JSON数据:
{ "dataFilters":{
"eventType":[
"Mobile Internet"
],
"destination":[
"United Kingdom"
],
"usageType":[
"All Usage",
"Exceeded my Allowance",
"Not included in my Allowance"
]
},
"voiceFilters":{
"eventType":[
"Special Voice Calls",
"Voice minutes",
"Three-to-Three minutes"
],
"destination":[
"Premium Rate Number",
"Mobile",
"3 Mobile",
"Voicemail",
"Iver"
],
"usageType":[
"All Usage",
"Exceeded my Allowance",
"Not included in my Allowance"
]
},
"msgFilters":{
"eventType":[
"Usage Message Event"
],
"destination":[
"India",
"Mobile"
],
"usageType":[
"All Usage",
"Exceeded my Allowance",
"Not included in my Allowance"
]
}
}
如果有人可以提供帮助并且可能提供解决方案或示例,请非常感谢。
谢谢
答案 0 :(得分:0)
这是让你入门的东西:
var optns = $.map( json.dataFilters.usageType, function( value, key ) {
return "<option value=" + key + ">" + value+ "</option>";
});
$("#selectId").append(optns);