@Override public void startArray(long currLine, long currCol) { arrays.push(new JsonArray()) ; }
@Override public void startArray(long currLine, long currCol) { arrays.push(new JsonArray()) ; }
public JsonBuilder startArray() { arrays.push(new JsonArray()) ; stack.push(State.ARRAY) ; return this ; }
public JsonBuilder startArray() { arrays.push(new JsonArray()) ; stack.push(State.ARRAY) ; return this ; }
@Test public void js_value_6() { JsonArray array = new JsonArray() ; read("[ ]", array) ; }
System.err.println(str); } else if(r.isJson()) { JsonArray tmp = new JsonArray(); r.getJsonItems().forEachRemaining(tmp::add); String json = tmp.toString();
@Test public void js_value_7() { JsonArray array = new JsonArray() ; array.add(JsonNumber.value(123)) ; read("[ 123 ]", array) ; }
@Override public JsonArray execJson() { checkNotClosed(); HttpQuery httpQuery = makeHttpQuery(); httpQuery.setAccept(WebContent.contentTypeJSON); JsonArray result = new JsonArray(); try(InputStream in = httpQuery.exec()) { JsonValue v = JSON.parseAny(in); if ( ! v.isArray() ) throw new QueryExecException("Return from a JSON query isn't an array"); result = v.getAsArray(); } catch (IOException e) { IO.exception(e); } finally { this.close(); } return result; }
@Test public void js_value_8() { JsonObject obj = new JsonObject() ; JsonArray array = new JsonArray() ; array.add(JsonNumber.value(123)) ; obj.put("a", array) ; read("{ \"a\" : [ 123 ] }", obj) ; }
@Override public JsonArray execJson() { checkNotClosed() ; if ( ! query.isJsonType() ) throw new QueryExecException("Attempt to get a JSON result from a " + labelForQuery(query)+" query") ; startQueryIterator() ; JsonArray jsonArray = new JsonArray() ; List<String> resultVars = query.getResultVars() ; while (queryIterator.hasNext()) { Binding binding = queryIterator.next() ; JsonObject jsonObject = new JsonObject() ; for (String resultVar : resultVars) { Node n = binding.get(Var.alloc(resultVar)) ; JsonValue value = RDFTerm2Json.fromNode(n) ; jsonObject.put(resultVar, value) ; } jsonArray.add(jsonObject) ; } return jsonArray ; }