According to the JSON grammar, there needs to be at least one thing, be it an object, value, or array. Shouldn't a parsing exception (EOF) be thrown for these? hasNext(), in addition to next(), throws a JsonParsingException when it advances to the next event, and since the parser encounters an EOF before the next event, it's technically invalid JSON.
https://github.com/leadpony/jsonp-test-suite/blob/5efa9962d5a0452a00e8a2b2546b541991be5190/src/main/java/org/leadpony/jsonp/testsuite/tests/AbstractJsonParserTest.java#L118-L119
According to the JSON grammar, there needs to be at least one thing, be it an object, value, or array. Shouldn't a parsing exception (EOF) be thrown for these?
hasNext()
, in addition tonext()
, throws aJsonParsingException
when it advances to the next event, and since the parser encounters an EOF before the next event, it's technically invalid JSON.Ref: https://tools.ietf.org/html/rfc8259#section-2