jsonp-api icon indicating copy to clipboard operation
jsonp-api copied to clipboard

Inconsistent spec for Parser and Generator w.r.t. generating/parsing a sequence of Objects

Open bergtwvd opened this issue 4 years ago • 0 comments

The JsonParser documentation shows:

JsonParser can be used to parse sequence of JSON values that are not enclosed in a JSON array, e.g. { } { }. The following code demonstrates how to parse such sequence.

 JsonParser parser = Json.createParser(...);
 while (parser.hasNext) {
     parser.next(); // advance parser state
     JsonValue value = parser.getValue();
 }

But with the JsonGenerator there is no way to create such a sequence. The only way to create a sequence is by putting the objects in an array. But this is different from the Parser.

bergtwvd avatar Sep 27 '21 22:09 bergtwvd