jsonp-api
jsonp-api copied to clipboard
Inconsistent spec for Parser and Generator w.r.t. generating/parsing a sequence of Objects
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.