Package swiss.trustbroker.common.util
Class JsonUtil
java.lang.Object
swiss.trustbroker.common.util.JsonUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tstatic ObjectparseJsonArray(String jsonData, boolean tryOnly) parseJsonObject(String jsonData, boolean tryOnly) static StringserializeToJson(Object dto) static StringserializeToJson(Object dto, tools.jackson.databind.ObjectMapper objectMapper)
-
Method Details
-
parseJson
- Parameters:
jsonData- JSON (may be null)tryOnly- if true returns null in case of errors- Returns:
- Map of property -> value for JSON objects, List of values for JSON arrays, or String value of primitives
-
parseJsonObject
- Parameters:
jsonData- JSON (may be null)tryOnly- if true returns null in case of errors- Returns:
- Map of property -> value containing List of values for JSON arrays, or String value of primitives
-
parseJsonArray
- Parameters:
jsonData- JSON (may be null)tryOnly- if true returns null in case of errors- Returns:
- List of values for JSON arrays, containing Map of property -> value, List, or String value of primitives
-
getField
- Type Parameters:
T-- Parameters:
jsonMap- returned by parseJsonObjectattribute-expectedClass-- Returns:
- attribute from map or null if not found or not of expectedClass
-
serializeToJson
-
serializeToJson
-