to json

Table of contents

Turns input into JSON, when possible. If input cannot be turned into JSON object, the filter just returns the input again.

{% comment %}
	Input
{% endcomment %}
{{ site | to_json }}
Plate Liquid filter: to_json
// Output
{"id": 783, "content_type": { "name": "site", "title": "Site" }, "name": "A beautiful Site", ...}
Output in json, can be used in Javascript for example

Vul hier uw eigen inhoud in.

Need help?

Have you any question which is not answered in this knowledge base? Contact us. We are here to help you.