All the default settings of JSON Parser can be represented using the JsonParser.Feature enumeration. The JsonParser.Feature.values() will return all the features that are available for JSONParser but whether a feature is enabled or disabled for a particular parser can be determined using the isEnabled() method of JsonParser.
Syntax
public static enum JsonParser.Feature extends Enum<JsonParser.Feature>
Example
import com.fasterxml.jackson.core.*; import java.io.*; public class JsonParserSettingsTest { public static void main(String[] args) throws IOException { String json = "[{\"name\":\"Adithya\", \"age\":\"30\"}," + "{\"name\":\"Ravi\", \"age\":\"35\"}]"; JsonFactory jsonFactory = new JsonFactory(); JsonParser jsonParser = jsonFactory.createParser(json); for(JsonParser.Feature feature : JsonParser.Feature.values()) { System.out.println(feature.name() + ":" + jsonParser.isEnabled(feature)); } } }
Output
AUTO_CLOSE_SOURCE:true ALLOW_COMMENTS:false ALLOW_YAML_COMMENTS:false ALLOW_UNQUOTED_FIELD_NAMES:false ALLOW_SINGLE_QUOTES:false ALLOW_UNQUOTED_CONTROL_CHARS:false ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER:false ALLOW_NUMERIC_LEADING_ZEROS:false ALLOW_NON_NUMERIC_NUMBERS:false ALLOW_MISSING_VALUES:false ALLOW_TRAILING_COMMA:false STRICT_DUPLICATE_DETECTION:false IGNORE_UNDEFINED:false INCLUDE_SOURCE_IN_LOCATION:true