@Override public void startObject(long currLine, long currCol) { objects.push(new JsonObject()) ; }
@Override public void startObject(long currLine, long currCol) { objects.push(new JsonObject()) ; }
@Override public JSONWriterFacade object() { if (top != null) { stack.push( top ); keystack.push( key ); top = new JsonObject(); } else { top = new JsonObject(); } return this; }
public JsonBuilder startObject(String startMarker) { markers.push(startMarker); objects.push(new JsonObject()) ; stack.push(State.OBJECT) ; return this ; }
public JsonBuilder startObject(String startMarker) { markers.push(startMarker); objects.push(new JsonObject()) ; stack.push(State.OBJECT) ; return this ; }
@Override public JsonObject next() { if (queryIterator == null) throw new NoSuchElementException(this.getClass() + ".next") ; try { 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); } return jsonObject ; } catch (NoSuchElementException ex) { close() ; throw ex ; } }
@Test public void js_value_4() { read("{}", new JsonObject()) ; }
@Test public void js_value_5() { JsonObject obj = new JsonObject() ; obj.put("a", JsonNumber.value(123)) ; read("{ \"a\": 123 }", obj) ; }
@Test public void js_map_ext_1() { JsonObject obj = new JsonObject() ; obj.put("abc", JsonNumber.value(123)) ; writeRead(obj) ; // Use of key. read("{abc: 123}", obj) ; } }
@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 ; }
JsonObject obj = new JsonObject() ; obj.put("x1", new JsonString("y")) ; obj.put("x2", JsonNumber.value(56)) ;
JsonObject obj = new JsonObject(); obj.put("@id", ns + "p"); obj.put("@type", "@id"); JsonObject json = new JsonObject(); json.put("p", obj); json.put("ex", ns);
JsonObject frame = new JsonObject(); frame = new JsonObject(); frame.put("http://schema.org/jobTitle", new JsonObject()); jenaCtx.set(JsonLDWriter.JSONLD_FRAME, JsonUtils.fromString(frame.toString())); jsonld = toString(m, RDFFormat.JSONLD_FRAME_FLAT, jenaCtx);