Filter: Convert variables to JSON output

How to convert variables to JSON output in Anqi CMS template?

jsonThe filter can convert a variable to JSON output.

Usage

jsonHow to use the filter:

{{ obj|json }}

For example, if you convert the bannerItem to JSON output, it can be written like this:

{{ item|dump }}
# 显示结果
{
  "logo":"http://127.0.0.1:8001/uploads/202309/14/eba5aa9dc4c45d18.webp",
  "id":1,
  "link":"",
  "alt":"Hello",
  "description":"",
  "type":"default"
}