# to\_json

Source: https://zotonic.com/docs/1968/to_json

URI: https://zotonic.com/id/1968

Language: en



Display any value as in JSON (JavaScript Object Notation).

For example:

```django
{{ [1,2,3]|to_json }}
```

Converts this list to a valid JSON UTF-8 encoded string which can be directly used in JavaScript calls.

Another example for a JSON object:

```django
{{ %{ a: 1, b: 2 }|to_json }}
```

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1968?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1968?language=en>)
