{{ | json_encode }} – JSON Encode

Returns the JSON representation of a value.

Usage:

{{ "red,green,blue" | split(",") | json_encode }}

Result:

["red","green","blue"]

This example demonstrates both the split and json_encode filters working together, showing how to convert a comma-separated string into a JSON array.


What are your feelings

Leave a Reply

Updated on January 9, 2025