84858687888990919293
public void test_ex() throws Exception { RuntimeException ex = new RuntimeException(); JSONObject object = (JSONObject) JSON.toJSON(ex); JSONArray array = object.getJSONArray("stackTrace"); array.getJSONObject(0).put("lineNumber", null); JSON.parseObject(object.toJSONString(), Exception.class); }
262728293031323334353637
text = JSON.toJSONString(list); System.out.println(text); } JSONArray array = JSON.parseArray(text); Body body = array.getObject(1, Body.class); Assert.assertEquals(1, body.getItems().size()); Assert.assertEquals("张三", body.getName()); }
406407408409410411412413414415416
} object.put(key, value); } else if (ch == '[') { // 减少嵌套,兼容android lexer.nextToken(); JSONArray list = new JSONArray(); this.parseArray(list, key); value = list; object.put(key, value); if (lexer.token() == JSONToken.RBRACE) {
10221023102410251026102710281029103010311032
case LBRACE: JSONObject object = new JSONObject(); value = parseObject(object, i); break; case LBRACKET: Collection items = new JSONArray(); parseArray(items, i); value = items; break; case NULL: value = null;
11791180118111821183118411851186118711881189
lexer.nextToken(); TreeSet<Object> treeSet = new TreeSet<Object>(); parseArray(treeSet, fieldName); return treeSet; case LBRACKET: JSONArray array = new JSONArray(); parseArray(array, fieldName); return array; case LBRACE: JSONObject object = new JSONObject(); return parseObject(object, fieldName);
367368369370371372373374375376377
} object.put(key, value); } else if (ch == '[') { // 减少潜套,兼容android lexer.nextToken(); JSONArray list = new JSONArray(); this.parseArray(list, key); value = list; object.put(key, value); if (lexer.token() == JSONToken.RBRACE) {
901902903904905906907908909910911
10231024102510261027102810291030103110321033
356357358359360361362363364365366
} object.put(key, value); } else if (ch == '[') { // 减少潜套,兼容android lexer.nextToken(); JSONArray list = new JSONArray(); this.parseArray(list); value = list; object.put(key, value); if (lexer.token() == JSONToken.RBRACE) {
884885886887888889890891892893894