### Question:
JsonSystem extends SimpleSystemImpl { @Override public SimpleSystem connect(String... params) throws Exception { if (params.length >= 2 && ("json".equals(params[0]))) { this.json = params[1]; this.setStartNode(new JsonNode(this, "jsonroot", parser.parse(json))); } else { this.params = params; } return this; } JsonSystem(SimpleGraph graph);  JsonSystem(); @Override SimpleSystem connect(String... params); Builder getBuilder(String url); SimpleNode post(String url, String postJson); SimpleNode of(String url, ClientResponse response); @Override SimpleNode moveTo(String nodeQuery, String... keys); @Override Class<? extends SimpleNode> getNodeClass(); static JsonSystem of(SimpleGraph graph, String json);  }### Answer:
@Test public void testJson() throws Exception { File jroot=new File("../simplegraph-json/src/test"); File[] jsonFiles = { new File(jroot,"pets.json"), new File(jroot,"menu.json"), new File(jroot,"employee.json"), new File(jroot,"datatypes.json") }; long[] expectedNodes = { 4, 20, 6, 43 }; int i = 0; for (File jsonFile : jsonFiles) { String json = FileUtils.readFileToString(jsonFile, "UTF-8"); if (debug) System.out.println(JsonPrettyPrinter.prettyPrint(json)); JsonSystem js = new JsonSystem(); js.connect("json", json); if (debug) js.getStartNode().forAll(SimpleNode.printDebug); long nodes = js.getStartNode().g().V().count().next().longValue(); assertEquals(expectedNodes[i++], nodes); switch (i) { case 4: assertEquals(1, js.getStartNode().g().V().hasLabel("results").count() .next().longValue()); long resultsCount = js.getStartNode().g().V().hasLabel("results").out() .count().next().longValue(); assertEquals(17, resultsCount); js.getStartNode().g().V().hasLabel("results").out() .forEachRemaining(rNode -> { if (debug) { System.out.println(String.format("%s=%s (%s)", rNode.label(), rNode.property("fulltext").value(), rNode.property("displaytitle").value())); rNode.vertices(Direction.OUT, "printouts") .forEachRemaining(pr -> { pr.keys().forEach(key -> { System.out.println(String.format("\t%s=%s", key, pr.property(key).value())); }); }); } }); break; } } }
@Test public void testGoogleMapsJsonApi() throws Exception { String url = "https: String json = IOUtils.toString(new URL(url), "UTF-8"); if (debug) System.out.println(json); JsonSystem js = new JsonSystem(); SimpleSystem dom = js.connect("json", json); if (debug) js.getStartNode().forAll(SimpleNode.printDebug); long nodeCount = js.g().V().count().next().longValue(); if (nodeCount > 5) { Holder<String> latHolder = new Holder<String>(); dom.g().V().hasLabel("location").forEachRemaining( v -> latHolder.add(v.property("lat").value().toString())); String lat = latHolder.getFirstValue(); if (debug) System.out.println(lat); assertTrue(lat.startsWith("50.9412")); } }