/** * Parses a string and retruns a JSON tree */ public static JsonNode json(String s) throws IOException { return json(s, false); }
/** * Parses a JSON stream */ public static JsonNode json(Reader reader) throws IOException { return json(reader, false); }
/** * Parses a string and retruns a JSON tree */ public static JsonNode json(String s) throws IOException { return json(s, false); }
/** * Parses a JSON stream */ public static JsonNode json(InputStream stream, boolean systemPropertySubstitution) throws IOException { return json(new InputStreamReader(stream, Charset.defaultCharset()), systemPropertySubstitution); }
/** * Parses a JSON stream */ public static JsonNode json(InputStream stream) throws IOException { return json((Reader) new InputStreamReader(stream, Charset.defaultCharset())); }
/** * Parses a JSON stream */ public static JsonNode json(InputStream stream, boolean systemPropertySubstitution) throws IOException { return json(new InputStreamReader(stream, Charset.defaultCharset()), systemPropertySubstitution); }
public static JsonNode json(Reader reader, boolean systemPropertySubstitution) throws IOException { StringBuilder bld = new StringBuilder(512); int c; while ((c = reader.read()) >= 0) { bld.append((char) c); } return json(bld.toString(), systemPropertySubstitution); }
/** * Parses a JSON stream */ public static JsonNode json(Reader reader) throws IOException { StringBuilder bld = new StringBuilder(512); int c; while ((c = reader.read()) >= 0) { bld.append((char) c); } return json(bld.toString()); }
public static JsonNode json(Reader reader, boolean systemPropertySubstitution) throws IOException { StringBuilder bld = new StringBuilder(512); int c; while ((c = reader.read()) >= 0) { bld.append((char) c); } return json(bld.toString(), systemPropertySubstitution); }
/** * Load resource as json document. * * @param resourceName * @return the root json node * @throws IOException */ public static final JsonNode loadJsonNode(String resourceName) throws IOException { return JsonUtils.json(loadResource(resourceName), true); }
private static JsonNode toJson(String object) { try { return JsonUtils.json(object); } catch (Exception e) { throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, object); } } }
public static void main(String[] args) throws Exception { try (FileReader fr1 = new java.io.FileReader(args[0]); FileReader fr2 = new java.io.FileReader(args[1])) { JsonNode f1 = JsonUtils.json(fr1, false); JsonNode f2 = JsonUtils.json(fr2, false); JsonCompare cmp = new JsonCompare(); DocComparator.Difference<JsonNode> diff = cmp.compareNodes(f1, f2); System.out.println(diff); } } }
private static JsonNode toJson(String object) { try { return JsonUtils.json(object); } catch (Exception e) { throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, object); } } }
private static JsonNode toJson(BSONObject object) { try { return JsonUtils.json(object.toString()); } catch (Exception e) { throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, object.toString()); } } }
/** * Load resource as json document. * * @param resourceName * @return the root json node * @throws IOException */ public static final JsonNode loadJsonNode(String resourceName) throws IOException { return JsonUtils.json(loadResource(resourceName)); }
/** * Load resource as json document. * * @param resourceName * @return the root json node * @throws IOException */ public static final JsonNode loadJsonNode(String resourceName) throws IOException { return JsonUtils.json(loadResource(resourceName), true); }
@Override protected JsonNode getLightblueCrudJson() throws Exception { return json(loadResource("/ldap-lightblue-crud.json", LightblueLdapTestHarness.class), true); }
@Override protected JsonNode getLightblueMetadataJson() throws Exception { return json(loadResource("/ldap-lightblue-metadata.json", LightblueLdapTestHarness.class), true); }
@Override protected JsonNode getDatasourcesJson() throws Exception { return json(loadResource("/ldap-datasources.json", LightblueLdapTestHarness.class), true); }
public static void main(String[] args) throws Exception { try (FileReader fr1 = new java.io.FileReader(args[0]); FileReader fr2 = new java.io.FileReader(args[1])) { JsonNode f1 = JsonUtils.json(fr1, false); JsonNode f2 = JsonUtils.json(fr2, false); JsonCompare cmp = new JsonCompare(); DocComparator.Difference<JsonNode> diff = cmp.compareNodes(f1, f2); System.out.println(diff); } } }