Skip to content

Commit

Permalink
DOC: Document the JSON parser in Jinja2 templates
Browse files Browse the repository at this point in the history
  • Loading branch information
creideiki authored and Wagner committed Oct 29, 2021
1 parent d7675bb commit 8337d74
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/user/bots.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4226,6 +4226,17 @@ Templates are in Jinja2 format with the event provided in the variable "event".
See the Jinja2 documentation at https://jinja.palletsprojects.com/ .
As an extension to the Jinja2 environment, the function "from_json" is
available for parsing JSON strings into Python structures. This is
useful if you want to handle complicated structures in the "output"
field of an event. In that case, you would start your template with a
line like::
{%- set output = from_json(event['output']) %}
and can then use "output" as a regular Python object in the rest of
the template.
Attachments are template strings, especially useful for sending
structured data. E.g. to send a JSON document including "malware.name"
and all other fields starting with "source."::
Expand Down

0 comments on commit 8337d74

Please sign in to comment.