Package com.jbstrap.core.utils
Class JSONUtil
java.lang.Object
com.jbstrap.core.utils.JSONUtil
Class containing the JSON utility methods
- Since:
- 4.0
- Author:
- JBStrap
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
getJsonValue
(com.google.gson.JsonElement element) Determines the Java value from the specified JSON object.static String
Creates a JSON object based on the specified Java object.static String
toJSON
(Parameters prm) Converts a parameter object to a JSON string.static String
toJSONValue
(Object value) Converts a Java value to the corresponding JSON value.
-
Method Details
-
toJson
Creates a JSON object based on the specified Java object.
During the conversion, the class'
JSonAttribute
annotations will be used as a basis.- Parameters:
obj
- The Java object to be converted- Returns:
- The converted JSON object
- See Also:
-
getJsonValue
Determines the Java value from the specified JSON object.- Parameters:
element
- The JSON object element- Returns:
- The Java value
-
toJSON
Converts a parameter object to a JSON string.- Parameters:
prm
- Parameter object- Returns:
- JSON string corresponding to the specified parameter object
-
toJSONValue
Converts a Java value to the corresponding JSON value.- Parameters:
value
- Java value- Returns:
- JSON value
-