Github user kinow commented on a diff in the pull request:
https://github.com/apache/jena/pull/114#discussion_r175061201
--- Diff:
jena-arq/src/main/java/org/apache/jena/query/ResultSetFormatter.java ---
@@ -516,6 +520,41 @@ static public void outputAsJSON(boolean booleanResult)
static public void outputAsJSON(OutputStream outStream, boolean
booleanResult)
{ output(outStream, booleanResult, SPARQLResultSetJSON) ; }
+ /** Output an iterator of JSON values.
+ *
+ * @param outStream output stream
+ * @param jsonItems The JSON values
+ */
+ public static void outputAsJSON(OutputStream outStream,
Iterator<JsonObject> jsonItems)
+ {
+ JSWriter jWriter = new JSWriter(outStream) ;
+ jWriter.startArray() ;
+ jWriter.startOutput() ;
+ while (jsonItems.hasNext())
+ {
+ jWriter.startObject() ;
+ JsonObject jsonItem = jsonItems.next() ;
+ for (Entry<String, JsonValue> entry: jsonItem.entrySet())
+ {
+ JsonValue value = entry.getValue() ;
+ String val = "";
+ if (value.isString()) {
--- End diff --
@afs but here I didn't have a `Node`, only the `JsonValue`, and had to
convert from `JsonValue` to `String`
---