Class JsonUtils
java.lang.Object
net.javacrumbs.jsonunit.core.internal.JsonUtils
Internal utility class to parse JSON values.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NodeconvertToJson(Object source, String label) Converts object to JSON.static NodeconvertToJson(Object source, String label, boolean lenient) Converts object to JSON.static NodeReturns node with given path.static NodeReturns node with given path.static StringgetPathPrefix(Object json) static ObjectjsonSource(Object json, String pathPrefix) static ObjectjsonSource(Object json, String pathPrefix, List<String> matchingPaths) static Objectstatic 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
-
jsonSource
-
getPathPrefix
-
wrapDeserializedObject
Wraps deserialized object - supports null, String, numbers, maps, lists, ... -
missingNode
-