Class JsonUtils

java.lang.Object
org.apache.cassandra.utils.JsonUtils

public final class JsonUtils extends Object
  • Field Details

    • JSON_OBJECT_MAPPER

      public static final com.fasterxml.jackson.databind.ObjectMapper JSON_OBJECT_MAPPER
    • JSON_OBJECT_PRETTY_WRITER

      public static final com.fasterxml.jackson.databind.ObjectWriter JSON_OBJECT_PRETTY_WRITER
  • Method Details

    • quoteAsJsonString

      public static String quoteAsJsonString(String s)
      Quotes string contents using standard JSON quoting.
    • decodeJson

      public static Object decodeJson(byte[] json)
    • decodeJson

      public static Object decodeJson(String json)
    • writeAsJsonBytes

      public static byte[] writeAsJsonBytes(Object value)
    • writeAsJsonString

      public static String writeAsJsonString(Object value)
    • writeAsPrettyJsonString

      public static String writeAsPrettyJsonString(Object value) throws MarshalException
      Throws:
      MarshalException
    • fromJsonMap

      public static <T> Map<String,T> fromJsonMap(String json)
    • fromJsonMap

      public static <T> Map<String,T> fromJsonMap(byte[] bytes)
    • fromJsonList

      public static List<String> fromJsonList(byte[] bytes)
    • fromJsonList

      public static List<String> fromJsonList(String json)
    • serializeToJsonFile

      public static void serializeToJsonFile(Object object, File outputFile) throws IOException
      Throws:
      IOException
    • serializeToJsonFileAtomic

      public static void serializeToJsonFileAtomic(Object object, File outputFile) throws IOException
      Throws:
      IOException
    • deserializeFromJsonFile

      public static <T> T deserializeFromJsonFile(Class<T> tClass, File file) throws IOException
      Throws:
      IOException
    • deserializeFromJsonBytes

      public static <T> T deserializeFromJsonBytes(Class<T> tClass, byte[] bytes) throws IOException
      Throws:
      IOException
    • handleCaseSensitivity

      public static void handleCaseSensitivity(Map<String,Object> valueMap)
      Handles unquoting and case-insensitivity in map keys.