Class JsonUtils


  • public class JsonUtils
    extends Object
    Internal utility class to parse JSON values.
    • Constructor Detail

      • JsonUtils

        public JsonUtils()
    • Method Detail

      • convertToJson

        public static Node convertToJson​(Object source,
                                         String label)
        Converts object to JSON.
        Parameters:
        source -
        label - label to be logged in case of error.
        Returns:
      • convertToJson

        public static Node convertToJson​(Object source,
                                         String label,
                                         boolean lenient)
        Converts object to JSON.
        Parameters:
        source -
        label - label to be logged in case of error.
        lenient - lenient parser used for expected values. Allows unquoted keys.
        Returns:
      • valueToNode

        public static Node valueToNode​(Object source)
        Converts value to Json node. It can be Map, String, null, or primitive. Should not be parsed, just converted.
        Parameters:
        source -
        Returns:
      • getNode

        public static Node getNode​(Object root,
                                   String path)
        Returns node with given path.
        Parameters:
        root -
        path -
        Returns:
      • getNode

        public static Node getNode​(Object root,
                                   Path path)
        Returns node with given path.
        Parameters:
        root -
        path -
        Returns:
      • nodeExists

        @Deprecated
        public static boolean nodeExists​(Object json,
                                         String path)
        Deprecated.
        Returns true if the node exists.
      • getPathPrefix

        public static String getPathPrefix​(Object json)
      • wrapDeserializedObject

        public static Node wrapDeserializedObject​(Object source)
        Wraps deserialized object - supports null, String, numbers, maps, lists, ...
      • missingNode

        public static Object missingNode()