在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
使用QJSON解析数据: JSon 字符串: {"Code":1,"Msg":"",
"Data":[{"NetType":"电信","ServerName":"test1","ServerAddr":"127.0.0.1:30001","ServerIp":"55551","ServerPort":3000,"OnlineCount":300,"MaxOnlineCount":0},{"NetType":"电信","ServerName":"test1","ServerAddr":"::13000","ServerIp":"::1","ServerPort":3000,"OnlineCount":3,"MaxOnlineCount":0},{"NetType":"电信","ServerName":"test1","ServerAddr":"127.0.0.1:3000","ServerIp":"::1","ServerPort":3000,"OnlineCount":3,"MaxOnlineCount":0}]}
Delphi代码: procedure TForm2.Button1Click(Sender: TObject); var Json,AItem:TQJson; i:Integer; begin Json:=TQJson.Create; Json.Parse(Memo1.Text); //ShowMessage(Json.AsString); AItem := Json.ItemByName('Data') ; for I := 0 to AItem.Count-1 do begin Memo2.Lines.Add(AItem.Items[i].ValueByName('NetType','')); Memo2.Lines.Add(AItem.Items[i].ValueByName('ServerAddr','')); Memo2.Lines.Add(AItem.Items[i].ValueByName('ServerIp','')); Memo2.Lines.Add(AItem.Items[i].ValueByName('ServerPort','')); Memo2.Lines.Add(AItem.Items[i].ValueByName('OnlineCount','')); Memo2.Lines.Add(AItem.Items[i].ValueByName('MaxOnlineCount','')); Memo2.Lines.Add('-----------------------------------------') end; end;
其它例子: 1.http://www.cnblogs.com/codingnote/p/3821025.html?utm_source=tuicool&utm_medium=referral
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论