public interface Json
When the web page is unloaded, all the JavaScript objects will be automatically disposed.
Access to the already disposed JavaScript object will lead to the IllegalStateException.
| Modifier and Type | Method and Description |
|---|---|
<T> T |
parse(java.lang.String json)
Creates an object that represents the result of parsing the given string in JSON format.
|
java.lang.String |
stringify(JsObject jsObject)
Converts the given JavaScript object into a JSON string.
|
@Nullable <T> T parse(java.lang.String json)
T - one of the following types: java.lang.Boolean, java.lang.Double,
java.lang.String, or JsObjectjson - a string in JSON formatnull if the result of parsing is null.
For example, when the given JSON string is "null", then the method returns nullJsException - when an invalid JSON string is passedjava.lang.IllegalArgumentException - when json is empty or blankjava.lang.String stringify(JsObject jsObject)
jsObject - a JavaScript object to convert into a JSON stringJsException - when the given JavaScript object cannot be converted to a JSON string.
For example, when a circular reference is found in the given JavaScript object