"json"和"json"之间有什么区别吗?和"tojson" jinja中的盐堆过滤器? [英] Is there any difference between "json" and "tojson" filters in jinja for saltstack?
问题描述
根据saltstack文档,它是"json": https://docs.saltstack.com/zh_CN/latest/ref/renderers/all/salt.renderers.jinja.html
According to saltstack documentation it's "json": https://docs.saltstack.com/en/latest/ref/renderers/all/salt.renderers.jinja.html
但是在jinja doc中 http://jinja.pocoo.org/docs/2.9/templates/#内置过滤器-不是"json",而是"tojson".
But in jinja doc http://jinja.pocoo.org/docs/2.9/templates/#builtin-filters - there is not "json", but "tojson".
有人知道为什么吗?
推荐答案
虽然我不能绝对肯定地说,但我的印象是Salt Renderers仅内置于Salt.例如,也有yaml
和python
渲染器,但没有针对Jinja的相应过滤器.
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.
因此,json
渲染器和tojson
过滤器由于其用途而恰好具有相似的名称.而且您将无法在Salt之外使用json
渲染器.
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.
这篇关于"json"和"json"之间有什么区别吗?和"tojson" jinja中的盐堆过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!