解析json字符串str
1、单对象
var str='{"WiFiMaxClients":10",WiFiSSID":"MiFi6620L-A087"}';
var data=eval("("+str+")");
$("#maxNum").text(data.WiFiMaxClients);
$("#connectedDevicesTitle").text(_("connected_devices_devices") + " (" + data.WiFiSSID + ")");
2、对象数组
devicesData =
devicesData = '[ {"ConnectedDeviceMacAddress": "bc:f5:ac:f7:15:71" },{"ConnectedDeviceMacAddress": "5c:f5:da:ed:98:a7" },{ "ConnectedDeviceMacAddress": "10:41:7f:39:c9:13", "Block": 0, "Status": "Offline" } ]';
connectedDevicesData = eval("("+devicesData+")");
if(oldconnectedDevicesData.length != connectedDevicesData.length || oldconnectedDevicesData == ""){
needReloadConConnectedDevice = true;
}else if(connectedDevicesData.length > 0){
for (var i=0; i < connectedDevicesData.length; i++) {
if(oldconnectedDevicesData[i].ConnectedDeviceMacAddress != connectedDevicesData[i].ConnectedDeviceMacAddress){
needReloadConConnectedDevice = true;
break;
}
};
}else if(connectedDevicesData.length == 0){
needReloadConConnectedDevice = true;
}