是否有任何工具或在线编辑器可用,以便指定如何访问json元素。例如,如果我提供json作为输入,那么我们应该得到一个输出,它将指定每个项目如何通过javascript访问
示例
假设输入
var myList={ "vehicleList": { "Vehicle": [ { "vehicleId": 88, "vehicleName": "veh1", "totalEvents": 10, "medium": 2, "Severe": 2, "Category": [ { "AlertId": 1001, "AlertName": "Overspeed", "Alertcount": 10 }, { "AlertId": 1002, "AlertName": "Sudden acceleration", "Alertcount": 40 } ] }, { "vehicleId": 87, "vehicleName": "veh2", "totalEvents": 11, "medium": 4, "Severe": 7, "Category": [ { "AlertId": 1003, "AlertName": "Overspeed", "Alertcount": 30}, { "AlertId": 1004, "AlertName": "Drunk", "Alertcount": 10 } ] }, { "vehicleId": 87, "vehicleName": "veh3", "totalEvents": 10, "medium": 2, "Severe": 2, "Category": [ { "AlertId": 1007, "AlertName": "Overspeed", "Alertcount": 10 }, { "AlertId": 1008, "AlertName": "Overspeed", "Alertcount": 77 } ] }, { "vehicleId": 86, "vehicleName": "veh4", "totalEvents": 11, "medium": 4, "Severe": 5, "Category": [ { "AlertId": 1009, "AlertName": "Overspeed", "Alertcount": 17 }, { "AlertId": 1010, "AlertName": "HighSpeed", "Alertcount": 10 } ] } ] } };
输出应一个结构,它将指定为
myList.vehicleList.Vehicle[3].Severe;
答案 0 :(得分:0)
看起来你向后看就意味着提供你需要的价值来获得价值。我没有解决方案。
但是我想建议json很容易阅读,可能是因为长串的字符串而遇到麻烦。试试这个网站(编辑)http://jsonlint.com/这将验证你的json,并以更易读的形式给你。希望这会以一种或另一种方式帮助你。