Getting JsonFactory settings

This post explains how to get JsonFactory settings. The JsonFactory class is thread safe and responsible for creating instances of writer and reader. Creating an instance of JsonFactory is an light weight operation.
The list of settings that can be turned on or off are present in an enumeration JsonFactory.Feature. The below code shows how to access their values

Main Code


package package4;

import com.fasterxml.jackson.core.JsonFactory;

public class ProcessingDemo4 {
    public static void main(String[] args) {
        JsonFactory jsonFactory = new JsonFactory();
        for(JsonFactory.Feature feature : JsonFactory.Feature.values()) {
            boolean result = jsonFactory.isEnabled(feature);
            System.out.println(feature.name() + ":" + result);
        }
    }
}

Output

INTERN_FIELD_NAMES:true
CANONICALIZE_FIELD_NAMES:true
FAIL_ON_SYMBOL_HASH_OVERFLOW:true
USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING:true

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s