to_json()
Usage
to_json(source [, view = 'public' [, depth = 3]])
Description
Returns a JSON string representation of the given object very similar to JSON.stringify() in JavaScript. This method can be used for debugging purposes, as well as to send JSON payloads using POST()
. The output of this method will be very similar to the output of the REST server except for the response headers and the result container.
The optional view
parameter can be used to select the view representation of the entity. If no view is given, the public
view is used.
The optional depth
parameter defines at which depth the JSON serialization stops. If no depth is given, the default value of 3 is used.
Example
${to_json(me)}
results in
{ "id": "6608098072bd44f68c0a9fdaa2571417", "type": "User", "isUser": true, "name": "tester1" }