1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
# Encoding Filters ## json_decode Parses a JSON string. ```html {{ '{"name": "test", "value": 123}' | json_decode | safe }} {# Output: {"name":"test","value":123} as object #} ``` ## urlescape URL encodes a string. ```html {{ "hello world! 123" | urlescape }} {# Output: hello%20world%21%20123 #} ``` ## urlunescape URL decodes a string. ```html {{ "hello%20world" | urlunescape }} {# Output: hello world #} ``` ## base64_encode Encodes to Base64. ```html {{ "Hello World" | base64_encode }} {# Output: SGVsbG8gV29ybGQ= #} ``` ## base64_decode Decodes from Base64. ```html {{ "SGVsbG8gV29ybGQ=" | base64_decode }} {# Output: Hello World #} ```