Class JSONUtil

java.lang.Object
org.infinispan.server.resp.json.JSONUtil

public class JSONUtil extends Object
  • Field Details

    • JSON_ROOT

      public static byte[] JSON_ROOT
    • objectMapper

      public static final com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • configForDefiniteSet

      public static final com.jayway.jsonpath.Configuration configForDefiniteSet
    • parserForDefiniteSet

      public static com.jayway.jsonpath.ParseContext parserForDefiniteSet
    • configForSet

      public static final com.jayway.jsonpath.Configuration configForSet
    • parserForSet

      public static com.jayway.jsonpath.ParseContext parserForSet
    • configForGet

      public static final com.jayway.jsonpath.Configuration configForGet
    • parserForGet

      public static com.jayway.jsonpath.ParseContext parserForGet
    • configForMod

      public static final com.jayway.jsonpath.Configuration configForMod
    • parserForMod

      public static com.jayway.jsonpath.ParseContext parserForMod
    • configForDefiniteMod

      public static final com.jayway.jsonpath.Configuration configForDefiniteMod
    • parserForDefiniteMod

      public static com.jayway.jsonpath.ParseContext parserForDefiniteMod
  • Constructor Details

    • JSONUtil

      public JSONUtil()
  • Method Details

    • isRoot

      public static boolean isRoot(byte[] path)
    • toJsonPath

      public static String toJsonPath(String path)
      Returns a jsonpath version of path with Redis regex patterns converted to Jayway format. This method performs two conversions in order: 1. Legacy path format conversion (e.g., ".foo" → "$.foo") 2. Redis regex format conversion on the result (e.g., =~ "pattern" → =~ /pattern/)
      Parameters:
      path - the path as a String
      Returns:
      path converted to Jayway-compatible JSONPath format
    • toJsonPath

      public static byte[] toJsonPath(byte[] path)
      Returns a jsonpath version of path with Redis regex patterns converted to Jayway format. This is a convenience method that converts byte[] to String, performs the conversions, and returns the result as byte[].
      Parameters:
      path - the path as byte[]
      Returns:
      path converted to Jayway-compatible JSONPath format as byte[]
    • isJsonPath

      public static boolean isJsonPath(byte[] path)
    • isJsonPath

      public static boolean isJsonPath(String path)
    • isValueInvalid

      public static boolean isValueInvalid(byte[] value)
    • convertRedisFilterToJayway

      public static String convertRedisFilterToJayway(String redisFilter)
      Converts any RedisJSON-style =~ "regex" fragments into Jayway =~ /regex/ format. Keeps the rest of the JSONPath filter untouched.