# escapejson

Source: https://zotonic.com/docs/1837/escapejson

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

Language: en



Escapes the value for safe insertion into JSON strings.

For example:

```django
{ "value": "{{ value | escapejson }}" }
```

When the value is `he"llo` then the output is `he\"llo`.

Or:

```django
{ "title": "{{ id.title | unescape  | escapejson }}" }
```

In Zotonic text properties of resources are automatically html escaped. In order to transform them to correct JSON these values have to be unescaped first.

Internally, this calls `z_utils:json_escape/1` to perform the string escaping.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1837?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/1837?language=en>)
