delphi 取json中数组的值(ISuperArray)
{ "action": "******", "data": [ { "Info1": { "ID": "1", "Name": "张三", }, "Info2": [ ...... ] }, "Info2": { "ID": "2", "Name": "李四", }, "Info2": [ ...... ] }, "Info3": { "ID": "3", "Name": "王二", }, "Info3": [ ...... ] }, ] }
要取出张三:
ShowMessage(jo_data.A['data'].O[0].O['Info1'].S['Name']);
以此类推
如下json:
[ [0,'192.168.11.18',[ [1,500,[['A-001','100,100,50,81',2],['A-002','100,100,50,81',2]]], [2,500,[['A-002','100,100,50,81',2],['A-003','100,100,50,81',2]]], ] ], [2,'192.168.11.18',[ [1,500,[['C-020','100,100,50,81',2],['A-001','100,100,50,81',2]]], [2,500,[['C-021','100,100,50,81',2],['A-001','100,100,50,81',2]]], ] ] ]
取值:(Log为memo1.lines.add())
Log(ja_data.A[0].I[0].ToString); // 0 Log(ja_data.A[0].S[1]); // 192.168.11.18 Log(ja_data.A[0].A[2].A[0].I[0].ToString); //1 Log(ja_data.A[0].A[2].A[0].I[1].ToString); // 500 Log(ja_data.A[0].A[2].A[0].A[2].A[0].S[0]); // A-001 Log(ja_data.A[0].A[2].A[0].A[2].A[1].S[0]); // A-002