JsonUtils { public static void parse(ObjectMapperSupplier objectMapperSupplier, String version, String json, MutableSanskritObject result) throws SanskritException { try { JsonNode jsonNode = objectMapperSupplier.getObjectMapper(version).readTree(json); jsonNodeToSanskritObject(objectMapperSupplier, version, result, jsonNode); } catch (IOException e) { throw new SanskritException(e); } }  static void parse(ObjectMapperSupplier objectMapperSupplier, String version, String json, MutableSanskritObject result);  }
@Test public void parseEmpty() throws Exception { String input = "{}"; SanskritObjectImpl result = new SanskritObjectImpl(objectMapperSupplier); JsonUtils.parse(objectMapperSupplier, null, input, result); assertNull(result.getString("A")); }
@Test public void parseData() throws Exception { String input = "{" + LS + " \"A\" : \"a\"," + LS + " \"B\" : 1," + LS + " \"C\" : {" + LS + " \"E\" : \"e\"" + LS + " }," + LS + " \"D\" : null" + LS + "}"; SanskritObjectImpl result = new SanskritObjectImpl(objectMapperSupplier); JsonUtils.parse(objectMapperSupplier, null, input, result); assertEquals("a", result.getString("A")); assertEquals(1L, (long) result.getLong("B")); assertNull(result.getObject("D")); SanskritObject child = result.getObject("C"); assertEquals("e", child.getString("E")); }