Support for non-standard JSON
By default Jackson only handles strictly valid JSON, as per JSON specification.
But to increase inter-operability (and as a result of specific user requests), Jackson have number of features that can be enabled to support certain alternative non-standard constructs.
Note that all these features must be explicitly enabled to work -- they are not enabled by default.
Parser-side non-standard features
As of version 1.0, Jackson allows:
JACKSON-9: Parsing "JSON" content that contains C and/or C++ style comments
Enabled by enabling JsonParser.Feature.ALLOW_COMMENTS
- (note: earlier drafts of JSON specification did indeed include ability to include such comments; as such they are still widely used "in the wild")
Version 1.2
JACKSON-69: Parsing "JSON" content that has unquoted field names (field names not surrounded by double quotes)
Enabled by enabling JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES
- Although this has never been allowed by JSON specification, basic Javascript allows it, and thus there are systems that assume this is legal
Version 1.3
- Whether to allow single quotes (apostrophes) as an alias for double quotes:
Enabled by enabling ALLOW_SINGLE_QUOTES
Version 1.4
JACKSON-208: Parsing "JSON" content that has unquoted control characters (tabs, linefeeds) in Strings (including field names)
- Added since some commonly used "JSON" interfaces (some Google APIs) do not properly quote included text content.
Version 1.6
JACKSON-300: Parsing "JSON" content that has non-standard backslash quotes (say, \')
- Added since some JSON escaping packages quote characters that are not defined as backslash-escapable in JSON.
Version 1.8
JACKSON-358: Parsing "JSON" content that has leading zeroes for integral numbers (000003).
- Added since some services produce such numbers; probably due to fixed-length formatting.
JACKSON-142: Parsing "JSON" content that uses tokens NaN/+INF/-INF/+Infinite/-Infinite as double values
- Added since these tokens may be produced by naive libraries when converting such numeric symbols (esp. since these are included in many other standards, like in XML Schema; as well as by most programming languages)
Generator-side non-standard features
As of version 1.0, Jackson allows:
- Writing field names without using double-quotes ("unquoted field names")
Enabled by disabling JsonGenerator.Feature.QUOTE_FIELD_NAMES
