@Test public void testParse() { Reader reader = TestUtil.loadResource(this.getClass(), "testdata.json"); TDNode node = TDJSONParser.get().parse(reader); log.info("testParse: Node=" + TestUtil.toJSON(node)); assertEquals("valueWithoutKey", node.getChildValue("3")); assertEquals("lastValueWithoutKey", node.getChildValue("6")); assertEquals(10, node.getChildValue("limit")); assertEquals("100000000000000000000", node.getChildValue("total")); assertEquals("Some Name 1", node.getValueByPath("data/0/name")); assertEquals("2nd st", node.getValueByPath("data/1/address/streetLine")); assertEquals("1", node.getByPath("data/1").getKey()); assertEquals("1", node.getByPath(new String[]{"data", "1"}).getKey()); assertTrue(node.getChild("total").isLeaf()); assertFalse(node.getChild("data").isLeaf()); assertArrayEquals(new String[]{"data", "1"}, node.getByPath("data/1").getPath().toArray(new String[0])); String json = TDJSONWriter.get().writeAsString(node); log.info("json: " + json); TDNode node1 = TDJSONParser.get().parse(json); assertEquals(node, node1); json = TDJSONWriter.get().writeAsString(node, new TDJSONOption().setIndentFactor(2)); log.info("formatted json: " + json); }
public TDNode parse(String str) { return parse(str, new TDJSONParserOption()); }
TDJSONParser { public TDNode parse(String str) { return parse(str, new TDJSONParserOption()); } }
TDJSONParser { public TDNode parse(String str) { return parse(str, new TDJSONParserOption()); }  }
TDJSONParser { public TDNode parse(String str) { return parse(str, new TDJSONParserOption()); }  static TDJSONParser get(); TDNode parse(String str); TDNode parse(String str, TDJSONParserOption opt); TDNode parse(Reader reader); TDNode parse(Reader reader, TDJSONParserOption opt); TDNode parse(CharSource src, TDJSONParserOption opt); TDNode parse(CharSource src, TDJSONParserOption opt, TDNode node); }
TDJSONParser { public TDNode parse(String str) { return parse(str, new TDJSONParserOption()); }  static TDJSONParser get(); TDNode parse(String str); TDNode parse(String str, TDJSONParserOption opt); TDNode parse(Reader reader); TDNode parse(Reader reader, TDJSONParserOption opt); TDNode parse(CharSource src, TDJSONParserOption opt); TDNode parse(CharSource src, TDJSONParserOption opt, TDNode node); final static InjectableInstance<TDJSONParser> instance; }