Android udp json+数组 --->bytes发送数据

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"}]}

 

    

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值