From 9e436a3c1557d78fcd5963f801bbf7f24d60559a Mon Sep 17 00:00:00 2001 From: yuri <1969yuri1969@gmail.com> Date: Mon, 18 Sep 2023 15:23:14 +0200 Subject: [PATCH] feat(docs): add ASCII-encoded input example to `json()` (#517) --- .../05.developer-guide/03.variables/04.function/json.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/content/docs/05.developer-guide/03.variables/04.function/json.md b/content/docs/05.developer-guide/03.variables/04.function/json.md index edb1eb4c03..6b5c25c87e 100644 --- a/content/docs/05.developer-guide/03.variables/04.function/json.md +++ b/content/docs/05.developer-guide/03.variables/04.function/json.md @@ -2,12 +2,15 @@ title: json --- -The `json` function will convert any string to object allowing to access to theirs properties +The `json` function will convert any string to object allowing to access its properties ```twig -{{ json('[1, 2, 3]')[0] }} +{{ json('[1, 2, 3]')[0] }} {# results in: '1' #} -{{ json('{"foo": [666, 1, 2]}').foo[0}} +{{ json('{"foo": [666, 1, 2]}').foo[0] }} {# results in: '666' #} + +{{ json('{"bar": "\u0063\u0327"}').bar }} +{# results in: 'ç' #} ```