Class JsonUtil
java.lang.Object
callofproject.dev.service.notification.util.JsonUtil
Utility class for converting objects to JSON strings and vice versa.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
convertObjectToJsonString
(Object object) Converts an object to a JSON string.static <T> T
deserializeJson
(String json, Class<T> clazz) Converts a JSON string to an object.
-
Method Details
-
convertObjectToJsonString
Converts an object to a JSON string.- Parameters:
object
- the object to be converted- Returns:
- the JSON string
- Throws:
IOException
- if the object cannot be converted to a JSON string
-
deserializeJson
Converts a JSON string to an object.- Type Parameters:
T
- the type of the object to be converted- Parameters:
json
- the JSON string to be convertedclazz
- the class of the object to be converted- Returns:
- the object
- Throws:
IOException
- if the JSON string cannot be converted to an object
-