Class JsonUtils
java.lang.Object
net.javacrumbs.jsonunit.core.internal.JsonUtils
public class JsonUtils extends Object
Internal utility class to parse JSON values.
-
Constructor Summary
Constructors Constructor Description JsonUtils() -
Method Summary
Modifier and Type Method Description static NodeconvertToJson(Object source, String label)Converts object to JSON.static NodeconvertToJson(Object source, String label, boolean lenient)Converts object to JSON.static NodegetNode(Object root, String path)Returns node with given path.static NodegetNode(Object root, Path path)Returns node with given path.static StringgetPathPrefix(Object json)static ObjectjsonSource(Object json, String pathPrefix)static ObjectmissingNode()static booleannodeAbsent(Object json, String path, Configuration configuration)static booleannodeAbsent(Object json, Path path, Configuration configuration)static booleannodeExists(Object json, String path)Deprecated.static NodevalueToNode(Object source)Converts value to Json node.static NodewrapDeserializedObject(Object source)Wraps deserialized object - supports null, String, numbers, maps, lists, ...
-
Constructor Details
-
JsonUtils
public JsonUtils()
-
-
Method Details
-
convertToJson
Converts object to JSON.- Parameters:
source-label- label to be logged in case of error.- Returns:
-
convertToJson
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
Converts value to Json node. It can be Map, String, null, or primitive. Should not be parsed, just converted.- Parameters:
source-- Returns:
-
getNode
Returns node with given path.- Parameters:
root-path-- Returns:
-
getNode
Returns node with given path.- Parameters:
root-path-- Returns:
-
nodeExists
Deprecated.Returns true if the node exists. -
nodeAbsent
-
nodeAbsent
-
jsonSource
-
getPathPrefix
-
wrapDeserializedObject
Wraps deserialized object - supports null, String, numbers, maps, lists, ... -
missingNode
-