Skip to content

Commit

Permalink
feat(docs): add ASCII-encoded input example to json() (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri1969 authored Sep 18, 2023
1 parent 6b7cd10 commit 9e436a3
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: 'ç' #}
```

1 comment on commit 9e436a3

@vercel
Copy link

@vercel vercel bot commented on 9e436a3 Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.