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

天涯浪子 提交于 2019-12-10 19:21:44

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/44299336/is-there-any-difference-between-json-and-tojson-filters-in-jinja-for-saltsta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!