This post explains how to get json parser default settings.
import java.io.File;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonParser.Feature;
public class ProcessingDemo2 {
public static void main(String[] args) throws JsonParseException, IOException {
File file = new File("jsondata.json");
JsonFactory jsonFactory = new JsonFactory();
JsonParser jsonParser = jsonFactory.createParser(file);
for(Feature feature : Feature.values()) {
System.out.println(feature.name() + ":" + jsonParser.isEnabled(feature));
}
}
}
All the settings of a JSON Parser are represented as JsonParser.Feature enum. Feature.values() will return all the features that are available for JSONParser but whether a feature is enabled or disabled for a particular parser is determined by using the below code
jsonParser.isEnabled(feature);
where ‘jsonParser’ is particular instance of JSONParser and ‘feature’ is one of the JSONParser.Feature enum values.
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
STRICT_DUPLICATE_DETECTION:false
IGNORE_UNDEFINED:false