Class JsonHelper


  • public class JsonHelper
    extends Object
    A simple JSON helper utility
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.fasterxml.jackson.core.JsonParser createJsonParser​(Reader input)
      Create a JsonParser with default feature values
      static com.fasterxml.jackson.core.JsonParser createJsonParser​(Reader input, boolean... arguments)
      Create a JsonParser with custom feature values Order of JsonParser arguments: Feature.ALLOW_COMMENTS Feature.ALLOW_UNQUOTED_FIELD_NAMES Feature.ALLOW_SINGLE_QUOTES Feature.ALLOW_UNQUOTED_CONTROL_CHARS Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER Feature.ALLOW_NUMERIC_LEADING_ZEROS Feature.ALLOW_NON_NUMERIC_NUMBERS
      static com.fasterxml.jackson.core.JsonParser createLenientJsonParser​(Reader input)
      Create a JsonParser with all features enabled.
      static com.fasterxml.jackson.databind.ObjectMapper createObjectMapper​(boolean... arguments)
      Order of ObjectMapper arguments: Feature.ALLOW_COMMENTS Feature.ALLOW_UNQUOTED_FIELD_NAMES Feature.ALLOW_SINGLE_QUOTES Feature.ALLOW_UNQUOTED_CONTROL_CHARS Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER Feature.ALLOW_NUMERIC_LEADING_ZEROS Feature.ALLOW_NON_NUMERIC_NUMBERS
    • Constructor Detail

      • JsonHelper

        public JsonHelper()
    • Method Detail

      • createObjectMapper

        public static com.fasterxml.jackson.databind.ObjectMapper createObjectMapper​(boolean... arguments)
        Order of ObjectMapper arguments: Feature.ALLOW_COMMENTS Feature.ALLOW_UNQUOTED_FIELD_NAMES Feature.ALLOW_SINGLE_QUOTES Feature.ALLOW_UNQUOTED_CONTROL_CHARS Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER Feature.ALLOW_NUMERIC_LEADING_ZEROS Feature.ALLOW_NON_NUMERIC_NUMBERS
        Parameters:
        arguments - list of ObjectMapper features
        Returns:
        objectMapper
      • createJsonParser

        public static com.fasterxml.jackson.core.JsonParser createJsonParser​(Reader input)
                                                                      throws IOException
        Create a JsonParser with default feature values
        Parameters:
        input - Reader to use for reading JSON content to parse
        Returns:
        new JsonParser
        Throws:
        IOException
      • createJsonParser

        public static com.fasterxml.jackson.core.JsonParser createJsonParser​(Reader input,
                                                                             boolean... arguments)
                                                                      throws IOException
        Create a JsonParser with custom feature values Order of JsonParser arguments: Feature.ALLOW_COMMENTS Feature.ALLOW_UNQUOTED_FIELD_NAMES Feature.ALLOW_SINGLE_QUOTES Feature.ALLOW_UNQUOTED_CONTROL_CHARS Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER Feature.ALLOW_NUMERIC_LEADING_ZEROS Feature.ALLOW_NON_NUMERIC_NUMBERS
        Parameters:
        input - Reader to use for reading JSON content to parse
        arguments - a boolean array with exactly 7 elements
        Returns:
        new JsonParser
        Throws:
        IOException
      • createLenientJsonParser

        public static com.fasterxml.jackson.core.JsonParser createLenientJsonParser​(Reader input)
                                                                             throws IOException
        Create a JsonParser with all features enabled.
        Parameters:
        input - Reader to use for reading JSON content to parse
        Returns:
        new JsonParser
        Throws:
        IOException