jsonObject、jsonArray的使用

来源:互联网 发布:图灵出版社 java 编辑:程序博客网 时间:2024/05/17 08:20
{       "brandInfo":{        "brand":"品牌",        "model":"型号",        "deviceId":"0007A8947C62"    }}

这是对象,用jsonObject解析

 {    "m2mAppVersion": "",    "devices": [        {            "deviceId": "C00000000001",             "userId":"6553387",            "deviceName": "MaTest",            "deviceCategory": "0524",            "attr":{                "brand":"haier",                "model":"H_0.0.1"            }        },        {          "deviceId": "C00000000001",           "userId":"6553387",          "deviceName": "MaTest",          "deviceCategory": "0524",          "attr":{              "brand":"haier",              "model":"H_0.0.1"          }      }     ]   }

这是数组,devices有多个设备,不能用一个device对象表示,中括号本身就表示数组,这里也表示数组,用jsonArray解析

原创粉丝点击