Hi,
I searched almost everywhere but couldn't find an answer on how to include a template and apply filter to it.
I have created toJson filter and trying to include text from another template and apply filter to it. I tried this
{% include 'another_template.txt'|jsonify %} -- this returns another_template not found error
If I remove jsonify then it works but doesn't convert my text to json.
Ritesh
This is resolved using macros. Here is an example:
{% macro parentLoader() %}
{% include "LogEventToFile/HiveToLocal.txt" %}
{% endmacro %}
{
"message": {{ parentLoader()|trim|jsonify }},
"runtime": {{runtime}}
}
Most helpful comment
This is resolved using macros. Here is an example:
{% macro parentLoader() %}
{% include "LogEventToFile/HiveToLocal.txt" %}
{% endmacro %}
{
"message": {{ parentLoader()|trim|jsonify }},
"runtime": {{runtime}}
}