## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> JSONENCODE[JSONENCODE]:::quoted
JSONENCODE --> End((END))
```
## Purpose
The `JSONENCODE` SQL function returns the JSON encoded text of regular text, with the special characters according to the JSON representation escaped.
See also [[JSONDECODE]] and [[JSONELEMENT]].
Parameters:
- Input (`ANY`): the input which will be encoded from it's type to JSON.
Returns: a text which is the input encoded to JSON as `varchar2`.
## Examples
The following example retrieves the JSON representation of a text:
```sql
select jsonencode('Special characters such as backslash (\) and quote (").')
----------------
"Special characters such as backslash (\\) and quote (\")."
```
The following example retrieves the JSON representation of a date/time:
```sql
select jsonencode(sysdateutc)
----------------
"2026-06-09T11:14:32.4407146Z"
```