Class Json5lParser

All Implemented Interfaces:
JsonMetaProvider, ArrayRecordReadable, RecordReadable, TokenReadable

public class Json5lParser extends Json5Parser
Parses JSON5L (JSON5 Lines) input into POJO models.
Media types

Handles Content-Type types: application/json5l, application/json5lines, text/json5l

Description

JSON5L combines the relaxed JSON5 dialect with JSONL's newline-delimited framing. Each non-empty, non-comment line is parsed as a complete JSON5 value (single-quoted strings, unquoted field names, trailing commas, comments, relaxed numbers). Because JSON5 is a strict superset of JSON, this parser also reads plain JSONL input unchanged.

Comment handling follows JSON5 line-by-line: a line that is blank or contains only a comment is skipped (like a blank line); inline comments within a record's JSON are tolerated. A /* */ block comment must open and close on the same physical line — block comments cannot span record boundaries.

Example:

// Parse JSON5L into a list of POJOs List<MyBean> list = Json5lParser.DEFAULT.read(json5lInput, List.class, MyBean.class);

Example input:

// header comment line {name:'Alice',age:30} {name:'Bob',age:25} // trailing comment

Notes:
  • This class is thread safe and reusable.
See Also:
  • Field Details

    • DEFAULT

      public static final Json5lParser DEFAULT
      Default parser, Accept=application/json5l.
  • Constructor Details

  • Method Details