setLenient

fun setLenient(lenient: Boolean)

Configure this parser to be liberal in what it accepts. By default this parser is strict and only accepts JSON as specified by RFC 7159. Setting the parser to lenient causes it to ignore the following syntax errors:

  • Streams that include multiple top-level values. With strict parsing, each stream must contain exactly one top-level value.
  • Numbers may be NaNs or infinities.
  • End of line comments starting with // or # and ending with a newline character.
  • C-style comments starting with /* and ending with */. Such comments may not be nested.
  • Names that are unquoted or 'single quoted'.
  • Strings that are unquoted or 'single quoted'.
  • Array elements separated by ; instead of ,.
  • Unnecessary array separators. These are interpreted as if null was the omitted value.
  • Names and values separated by = or => instead of :.
  • Name/value pairs separated by ; instead of ,.