Search code examples
jsonjinja2salt-project

Is there any difference between "json" and "tojson" filters in jinja for saltstack?


According to saltstack documentation it's "json": https://docs.saltstack.com/en/latest/ref/renderers/all/salt.renderers.jinja.html

But in jinja doc http://jinja.pocoo.org/docs/2.9/templates/#builtin-filters - there is not "json", but "tojson".

Does anybody know why?


Solution

  • While I can't say absolutely for sure, I have an impression that Salt Renderers are built-in for Salt only. For example, there are also yaml and python renderers, but there is no corresponding filter for Jinja.

    So, json renderer and tojson filter just happened to have similar names because of their purpose. And you won't be able to use json renderer outside of Salt.