Package com.aducid.sdk.util
Class JsonUtils
java.lang.Object
com.aducid.sdk.util.JsonUtils
public class JsonUtils
extends java.lang.Object
JSON utilities.
Created 19. 1. 2017 8:34:39
- Author:
- Radek Jira
-
Method Summary
Modifier and Type Method Description static <T> TfromJson(java.lang.String objectAsJson, java.lang.Class<T> clazz)Extracts object from JSON.static java.util.List<java.lang.String>stringListFromJson(java.lang.String stringListAsJson)Extracts string list from JSON.static java.lang.StringtoJson(java.lang.Object object)Writes object to JSON.static java.lang.StringtoJsonResult(AducidClientException clientException)Writes client exception to JSON result.static java.lang.StringtoJsonResult(java.lang.Object object)Writes object to JSON result.
-
Method Details
-
fromJson
public static <T> T fromJson(java.lang.String objectAsJson, java.lang.Class<T> clazz) throws AducidClientExceptionExtracts object from JSON.
- Type Parameters:
T- object type- Parameters:
objectAsJson- object as JSONclazz- required object- Returns:
- extracted object
- Throws:
AducidClientException- when error occurs during ADUCID client call
-
stringListFromJson
public static java.util.List<java.lang.String> stringListFromJson(java.lang.String stringListAsJson) throws AducidClientExceptionExtracts string list from JSON.
- Parameters:
stringListAsJson- string list as JSON- Returns:
- list of strings
- Throws:
AducidClientException- when error occurs during ADUCID client call
-
toJson
Writes object to JSON.
- Parameters:
object- object to write- Returns:
- object as JSON
- Throws:
AducidClientException- when error occurs during ADUCID client call
-
toJsonResult
public static java.lang.String toJsonResult(java.lang.Object object)Writes object to JSON result.
- Parameters:
object- object to write- Returns:
- result as JSON
-
toJsonResult
Writes client exception to JSON result.
- Parameters:
clientException- client exception to write- Returns:
- client exception result as JSON
-