Package org.apache.cayenne.value.json
Class JsonUtils
- java.lang.Object
-
- org.apache.cayenne.value.json.JsonUtils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
compare(String json1, String json2)
Method that compares two JSON documents.static String
normalize(String json)
Cleanup and reformat any valid JSON string.
-
-
-
Method Detail
-
normalize
public static String normalize(String json)
Cleanup and reformat any valid JSON string. Generally this methods just removes unnecessary whitespaces in the document.- Parameters:
json
- valid JSON document- Returns:
- normalized JSON
-
compare
public static boolean compare(String json1, String json2)
Method that compares two JSON documents.
NOTE this method doesn't parse numbers so same numbers in different format will be different.
This methods will parse documents so it will ignores object keys ordering and whitespaces.- Parameters:
json1
- first valuejson2
- second value- Returns:
- true if documents are equal
-
-