Serve an object encoded as JSON.
This tag with either serialize an object (obj) if provided, or serve the tag text as JSON.
Like other serve- tags, this will return a response and stop processing the view.
<!-- serialize an object --><serve-json obj="{'status': 'ok'}"/><!-- just serve the contents --><serve-json>{"crew": ["john", "scorpius"]}</serv-json>
name | purpose | type | required? | default | choices |
---|---|---|---|---|---|
indent |
Indent to make JSON more readable | integer | No | 4 |
|
obj |
Object to build JSON from | expression | No | None |
name | purpose | type | required? | default | choices |
---|---|---|---|---|---|
if |
Conditional expression | expression | No | yes |