Serve a dict encoded as a JSON object.
Like other serve- tags, this will return a response and stop processing the view.
Keys in the json object can be given via the let extension. Here's an example:
<serve-json-object let:success="yes" let:message="'upload was successful'"/>
This will serve the following JSON:
{"success": true,"message": "upload was successful"}
You can also create the json object as you would a <dict>. The following returns the same response as above:
<serve-json-object><let success="yes"/><let-str msg="upload was successful"/></serve-json-object/>
name | purpose | type | required? | default | choices |
---|---|---|---|---|---|
indent |
Indent to make JSON more readable | integer | No | 4 |
name | purpose | type | required? | default | choices |
---|---|---|---|---|---|
if |
Conditional expression | expression | No | yes |