{ "10.10.11.1": { "target_1": "34.2", "target_3": "70.83", "target_2": "50.51", "target_5": "110.68", "c_event": "event", "target_4": "90.79", "c_timestamp": "12:54:34", "target_6": "10.2", "c_subject": "10.18.11.0" } }
{string,map<String,String>}类似这样的格式
js函数:
function getValue(){ var str = '{ "10.10.11.1": { "target_1": "34.2","target_3": "70.83","target_2": "50.51"}}'; var map = eval("("+str+")"); for (var key in map) { var a = map[key]; for (var k in a) { alert(k+'---'+a[k]); } } }
思路:现将json串,解析为map对象,可是在chrome浏览器不支持。