{ "face": [ { "attribute": { "age": { "range": 5, "value": 12.5 }, "gender": { "confidence": 60.6197, "value": "Female" }, "race": { "confidence": 99.9178, "value": "Asian" }, "smiling": { "value": 93.8853 } }, "face_id": "199d1efd19ce4ee67a7ec7655f859b1a", "position": { "center": { "x": 49.285714, "y": 18.5 }, "eye_left": { "x": 44.718571, "y": 15.424933 }, "eye_right": { "x": 53.37881, "y": 14.9466 }, "height": 11.666667, "mouth_left": { "x": 45.677381, "y": 22.597167 }, "mouth_right": { "x": 51.64, "y": 22.462333 }, "nose": { "x": 48.300714, "y": 19.778667 }, "width": 16.666667 }, "tag": "" } ], "img_height": 1140, "img_id": "892280e2a4b36175fea0b4377d635c51", "img_width": 798, "session_id": "02c0b5df1c6c4f59b80d10f80e3e7cfc", "url": "http://faceplusplus.com/static/img/demo/1.jpg" }
我用这个:
Dim key As String = e.Form.Controls("TextBox1").value Dim secret As String = e.Form.Controls("TextBox2").value Dim url As String = e.Form.Controls("TextBox3").value Dim XMLH As Object XMLH = CreateObject("Microsoft.XMLHTTP") XMLH.open("GET", "https://apicn.faceplusplus.com/v2/detection/detect?url=" & url & "&api_secret=" & secret & "&api_key=" & key, True) '获得实时信息 XMLH.send(Nothing) Do While XMLH.readyState <> 4 Application.DoEvents Loop '把数据json数据转化成对象 Dim json As String = XMLH.responseText Dim ScriptControl As Object,data As Object,JscriptCode As String JscriptCode = "function toObject(json) {eval(""var o=""+json);return o;}" ScriptControl = CreateObject("MSScriptControl.ScriptControl") With ScriptControl .Language = "Javascript" .Timeout = -1 .AddCode(JscriptCode) data = .Run("toObject", json) End With MessageBox.Show(json) e.Form.Controls("Label1").text = "img_height:" & data.img_height e.Form.Controls("Label2").text = "img_width:" & data.img_width e.Form.Controls("Label3").text = "img_id:" & data.img_id e.Form.Controls("Label4").text = "session_id:" & data.session_id e.Form.Controls("Label5").text = "url:" & data.url
已经读取了除face中的内容了。
请问如何读取这个face数组呢?