toJSON
Creates a JSON String representation of the specified value and stores it into the variable context. The JSON produced by this command can be then later given to the parseJSON command to re-create the original value, unless the JSON was created out of a value of a type that doesn't convert into JSON very well.
The JSON conversion works best on Collections, Maps, Numbers, Strings and Booleans, which have their own representations in the JSON specification. To convert various other values, the serialize attribute can be used to activate a feature that makes this command convert various other value types in a way that parseJSON can then re-create them.
Attributes
var |
|
|
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | No |
Defines the name of the variable holding the JSON String. |
value |
|
|
---|---|---|
Required | Value type | EL-evaluated |
Yes | Any | Yes |
Defines the value of which the JSON representation is created of. If the value is a Collection, Map, Number, String or Boolean, the JSON can be parsed back into a value of that type by parseJSON If the serialize attribute resolves into |
serialize |
|
|
---|---|---|
Required | Value type | EL-evaluated |
No | Boolean | Yes |
Allows this command to be put into an advanced serialization mode, in which the JSON it produces out of various values becomes such that parseJSON can re-create the values. In this case parseJSON must also have its deserialize attribute resolve into |