在浏览器的开发者工具中输入以下命令,回车
var json1={"code": 100,
"data": [
{"box": [[1282, 1104], [1501, 1104], [1501, 1148], [1282, 1148]], "score": 0.9156272411346436, "text": "\u6276\u98ce\u53bf\u516c\u5b89\u5c40", "end": "\n"},
{"box": [[1282, 1185], [1563, 1185], [1563, 1222], [1282, 1222]],"score": 0.8834136128425598, "text": "20QP0531\u957f\u671f", "end": "\n"}
]
};{alert(json1.data[0].box)}
浏览器弹窗显示:
1282,1104,1501,1104,1501,1148,1282,1148
即为第一个box的坐标,这个坐标也是数组,可以通过下标[0]来指定:
var json1={"code": 100,
"data": [
{"box": [[1282, 1104], [1501, 1104], [1501, 1148], [1282, 1148]], "score": 0.9156272411346436, "text": "\u6276\u98ce\u53bf\u516c\u5b89\u5c40", "end": "\n"},
{"box": [[1282, 1185], [1563, 1185], [1563, 1222], [1282, 1222]],"score": 0.8834136128425598, "text": "20QP0531\u957f\u671f", "end": "\n"}
]
};{alert(json1.data[0].box[0])}
浏览器弹窗显示:
1282,1104