Class JsonFunctions


  • public class JsonFunctions
    extends Object
    Inbuilt json related transform functions An example DimFieldSpec that needs the toJsonMapStr function: "dimFieldSpecs": [{ "name": "jsonMapStr", "dataType": "STRING", "transformFunction": "toJsonMapStr(jsonMap)" }]
    • Method Detail

      • toJsonMapStr

        public static String toJsonMapStr​(@Nullable
                                          Map map)
                                   throws com.fasterxml.jackson.core.JsonProcessingException
        Convert Map to Json String
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException
      • jsonFormat

        public static String jsonFormat​(Object object)
                                 throws com.fasterxml.jackson.core.JsonProcessingException
        Convert object to Json String
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException
      • jsonPath

        public static Object jsonPath​(Object object,
                                      String jsonPath)
        Extract object based on Json path
      • jsonPathArray

        public static Object[] jsonPathArray​(Object object,
                                             String jsonPath)
        Extract object array based on Json path
      • jsonPathArrayDefaultEmpty

        public static Object[] jsonPathArrayDefaultEmpty​(@Nullable
                                                         Object object,
                                                         String jsonPath)
      • jsonPathString

        public static String jsonPathString​(Object object,
                                            String jsonPath)
                                     throws com.fasterxml.jackson.core.JsonProcessingException
        Extract from Json with path to String
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException
      • jsonPathString

        public static String jsonPathString​(@Nullable
                                            Object object,
                                            String jsonPath,
                                            String defaultValue)
        Extract from Json with path to String
      • jsonPathLong

        public static long jsonPathLong​(Object object,
                                        String jsonPath)
        Extract from Json with path to Long
      • jsonPathLong

        public static long jsonPathLong​(@Nullable
                                        Object object,
                                        String jsonPath,
                                        long defaultValue)
        Extract from Json with path to Long
      • jsonPathDouble

        public static double jsonPathDouble​(Object object,
                                            String jsonPath)
        Extract from Json with path to Double
      • jsonPathDouble

        public static double jsonPathDouble​(@Nullable
                                            Object object,
                                            String jsonPath,
                                            double defaultValue)
        Extract from Json with path to Double