|
@@ -1,30 +0,0 @@
|
|
|
-package com.iamberry.rst.utils;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import net.sf.json.JSONArray;
|
|
|
-import net.sf.json.JSONObject;
|
|
|
-
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-/**
|
|
|
- * Created by Administrator on 2017/6/20.
|
|
|
- */
|
|
|
-public class test {
|
|
|
- public static void main(String[] args){
|
|
|
- String data = "{\"dataId\":\"0005520031E364758439780F4F85E8FF\",\"devId\":\"002001015ccf7f944f3f\",\"dpa\":[{\"milk_box_state\":true,\"t\":1497535674017}],\"productKey\":\"4Ic6GgKI0vUG65Jd\"}";
|
|
|
- JSONObject jasonObject = JSONObject.fromObject(data);
|
|
|
- System.out.println(jasonObject.has("dps"));
|
|
|
- if(jasonObject.has("dps")){
|
|
|
- JSONArray dps = jasonObject.getJSONArray("dps");
|
|
|
- Map maps = (Map) JSON.parse(dps.getJSONObject(0).toString());
|
|
|
- Map mapTypes = JSON.parseObject(dps.getJSONObject(0).toString());
|
|
|
- System.out.println(mapTypes);
|
|
|
- for (Object obj : maps.keySet()){
|
|
|
- System.out.println("key为:"+obj+"值为:"+maps.get(obj));
|
|
|
- }
|
|
|
- System.out.println(dps.getJSONObject(0));
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-}
|