public class JSONParserConfiguration extends ParserConfiguration
DEFAULT_MAXIMUM_NESTING_DEPTH, keepStrings, maxNestingDepth, UNDEFINED_MAXIMUM_NESTING_DEPTH| Constructor and Description |
|---|
JSONParserConfiguration()
Configuration with the default values.
|
| Modifier and Type | Method and Description |
|---|---|
protected JSONParserConfiguration |
clone()
Provides a new instance of the same configuration.
|
boolean |
isOverwriteDuplicateKey()
The parser's behavior when meeting duplicate keys, controls whether the parser should
overwrite duplicate keys or not.
|
boolean |
isStrictMode() |
JSONParserConfiguration |
withMaxNestingDepth(int maxNestingDepth)
Defines the maximum nesting depth that the parser will descend before throwing an exception
when parsing a map into JSONObject or parsing a
Collection instance into
JSONArray. |
JSONParserConfiguration |
withOverwriteDuplicateKey(boolean overwriteDuplicateKey)
Controls the parser's behavior when meeting duplicate keys.
|
JSONParserConfiguration |
withStrictMode()
Sets the strict mode configuration for the JSON parser with default true value
|
JSONParserConfiguration |
withStrictMode(boolean mode)
Sets the strict mode configuration for the JSON parser.
|
getMaxNestingDepth, isKeepStrings, withKeepStringspublic JSONParserConfiguration()
protected JSONParserConfiguration clone()
ParserConfigurationclone in class ParserConfigurationpublic JSONParserConfiguration withMaxNestingDepth(int maxNestingDepth)
Collection instance into
JSONArray. The default max nesting depth is 512, which means the parser will throw a JsonException
if the maximum depth is reached.withMaxNestingDepth in class ParserConfigurationmaxNestingDepth - the maximum nesting depth allowed to the JSON parserpublic JSONParserConfiguration withOverwriteDuplicateKey(boolean overwriteDuplicateKey)
overwriteDuplicateKey - defines should the parser overwrite duplicate keys.public JSONParserConfiguration withStrictMode()
When strict mode is enabled, the parser will throw a JSONException if it encounters an invalid character immediately following the final ']' character in the input. This is useful for ensuring strict adherence to the JSON syntax, as any characters after the final closing bracket of a JSON array are considered invalid.
public JSONParserConfiguration withStrictMode(boolean mode)
When strict mode is enabled, the parser will throw a JSONException if it encounters an invalid character immediately following the final ']' character in the input. This is useful for ensuring strict adherence to the JSON syntax, as any characters after the final closing bracket of a JSON array are considered invalid.
mode - a boolean value indicating whether strict mode should be enabled or notpublic boolean isOverwriteDuplicateKey()
overwriteDuplicateKey configuration value.public boolean isStrictMode()