Android udp json+数组 --->bytes发送数据
程序员文章站
2022-06-30 13:55:23
Android json支持五种数据类型 String / int(float)/bool / null / object 今天说 object : ......
android json支持五种数据类型
string / int(float)/bool / null / object
今天说 object :
json = new jsonobject(); json.put("cmd","put"); json.put("token",tokenjson.getstring("token")); json.put("id",jsonobject.getstring("id")); json.put("type",jsonobject.getstring("type")); json.put("pwd",jsonobject.getstring("pwd")); json.put("ul",jsonobject.getstring("ul")); json.put("zt",jsonobject.getstring("zt")); json.put("lt",jsonobject.getstring("lt"));
jsonarray array=new jsonarray(jsonobject.getstring("ll"));
json.put("ll", array);
结果:
{"cmd":"put","token":"bcfcf2440ef3f6445647578c54c11a0c","id":"zg000112","type":"4","pwd":"console","ul":"1","zt":"1","lt":"1","bool":true,"ll":[{"ipport":3000,"lable":"land1","enable":1,"ipaddr":"192.168.4.22"},{"ipport":3000,"lable":"land2","enable":0,"ipaddr":"192.168.4.23"},{"ipport":3000,"lable":"land3","enable":0,"ipaddr":"192.168.4.24"},{"ipport":3000,"lable":"land4","enable":0,"ipaddr":"192.168.4.25"}]}
上一篇: 关于go语言的测试相关内容笔记
下一篇: tab下拉显示