-
-
Notifications
You must be signed in to change notification settings - Fork 800
JsonParser Features
Tatu Saloranta edited this page Nov 18, 2013
·
10 revisions
Jackson Streaming API has a set of on/off features that change the way streaming parsing is done.
Features can be directly enabled/disabled on JsonParser
instances, but more commonly default values are changed on JsonFactory
instances.
For example:
JsonFactory f = new JsonFactory();
f.enable(JsonParser.Feature.ALLOW_COMMENTS);
f.disable(JsonParser.Feature.ALLOW_SINGLE_QUOTES);
JsonParser p = f.createParser(jsonSource);
p.enable(JsonParser.Feature.STRICT_DUPLICATE_DETECTION);
Settings can be divided in couple of loose categories, as follows.
- AUTO_CLOSE_SOURCE (default: true)
- ALLOW_COMMENTS (default: false)
- ALLOW_YAML_COMMENTS (default: false)
- ALLOW_UNQUOTED_FIELD_NAMES (default: false)
- ALLOW_SINGLE_QUOTES (default: false)
- ALLOW_UNQUOTED_CONTROL_CHARS (default: false)
- ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER (default: false)
- ALLOW_NUMERIC_LEADING_ZEROS (default: false)
- ALLOW_NON_NUMERIC_NUMBERS (default: false)
- ** STRICT_DUPLICATE_DETECTION** (default: false) (added in
2.3
)