Class Json5TokenReader

java.lang.Object
org.apache.juneau.marshall.json.JsonTokenReader
org.apache.juneau.marshall.json5.Json5TokenReader
All Implemented Interfaces:
Closeable, AutoCloseable, RecordReader, TokenReader
Direct Known Subclasses:
Json5lTokenReader

public class Json5TokenReader extends JsonTokenReader
Reference implementation of the public TokenReader surface for the JSON5 format.

Subclasses JsonTokenReader to add the JSON5 dialect's relaxations:

  • Strings can be single-quoted, double-quoted, or unquoted bare identifiers.
  • Field names can be single-quoted, double-quoted, or unquoted bare identifiers.
  • Trailing commas before ] / } are allowed.
  • Missing values in arrays / objects emit TokenType.VALUE_NULL.
  • JavaScript comments (// line, /* */ block) are tolerated — already accepted by the parent class.
  • JSON5 numbers: leading +, leading/trailing decimal points, hexadecimal, Infinity/NaN.
  • String line-continuation (backslash + line terminator is omitted from the value).

The cursor is a true O(1)-memory streaming cursor (TokenReader.isStreaming() == true).

Notes:
  • This class is not thread safe.
  • The cursor is purely structural; object swaps and @Schema annotations have no effect. Use the POJO databind path on Json5Parser for those.