Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 505 Bytes

json.md

File metadata and controls

39 lines (30 loc) · 505 Bytes
title
json

{% since %}v9.10.0{% endsince %}

Convert values to string via JSON.stringify(), for debug purpose.

Input

{% assign arr = "foo bar coo" | split: " " %}
{{ arr | json }}

Output

["foo","bar","coo"]

Space

{% since %}v10.11.0{% endsince %}

An additional space parameter can be specified to format the JSON.

Input

{% assign arr = "foo bar coo" | split: " " %}
{{ arr | json: 4 }}

Output

[
    "foo",
    "bar",
    "coo"
]