- @Test
- public void TestJson(){
- ServiceNode serviceNode = new ServiceNode();
- serviceNode.setIp("111");
- String jsonString = "{\"uid\":\"189024\", \"region\":\"SouthChina\", \"order\":123}";
- String COMPLEX_JSON_STR = "{\"teacherName\":\"crystall\",\"teacherAge\":27,\"course\":{\"courseName\":\"english\",\"code\":1270},\"students\":[{\"studentName\":\"lily\",\"studentAge\":12},{\"studentName\":\"lucy\",\"studentAge\":15}]}";
-
- JSONObject jsonObject = JSON.parseObject(COMPLEX_JSON_STR);
- JSONArray jsonArray = jsonObject.getJSONArray("students");
- System.out.printf("jsonObject:"+jsonArray);
-// System.out.println("uid:" + retMap.get("uid") + ", " + "region:" + retMap.get("region") + ", " + "order:" + retMap.get("order"));
- }