Class JsonUtils

java.lang.Object
net.javacrumbs.jsonunit.core.internal.JsonUtils

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

    • JsonUtils

      public JsonUtils()
  • Method Details

    • convertToJson

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

      public static Node convertToJson(@Nullable Object source, String label, boolean lenient)
      Converts object to JSON.
    • getNode

      public static Node getNode(@Nullable Object root, String path)
      Returns node with given path.
    • getNode

      public static Node getNode(@Nullable Object root, Path path)
      Returns node with given path.
    • nodeAbsent

      public static boolean nodeAbsent(@Nullable Object json, String path, Configuration configuration)
    • nodeAbsent

      public static boolean nodeAbsent(@Nullable Object json, Path path, Configuration configuration)
    • jsonSource

      public static Object jsonSource(Object json, String pathPrefix)
    • jsonSource

      public static Object jsonSource(Object json, String pathPrefix, List<String> matchingPaths)
    • getPathPrefix

      public static String getPathPrefix(@Nullable Object json)
    • wrapDeserializedObject

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

      public static Object missingNode()