---
title: "JSONENCODE"
description: "The JSONENCODE SQL function returns the JSON encoded text of regular text, with the special characters according to the JSON representation escaped."
language: ja
source_language: en
translation_state: pending
canonical: https://documentation.invantive.eu/ja/docs/invantive-universalsql/grammar/sql-functions/jsonencode
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/jsonencode
updated: 2026-12-04T12:14:55Z
license: https://documentation.invantive.eu/ja/
---

## 構文
```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))
```

## 目的
The `JSONENCODE` SQL function returns the JSON encoded text of regular text, with the special characters according to the JSON representation escaped.

関連項目：[[JSONDECODE]]および[[JSONELEMENT]]。

パラメータ:
- Input (`ANY`): the input which will be encoded from its type to JSON.

Returns: a text which is the input encoded to JSON as `varchar2`. A `null` input returns the JSON literal `null`, whether it is a constant or the value of a column, so a JSON text built by concatenation stays valid.

## 例
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 builds a JSON object for every row, also for a row without a value:
```sql
select '{"name": ' || jsonencode(v.name) || '}'
from   ( select 'Invantive' name from dual@DataDictionary
         union all
         select null from dual@DataDictionary
       ) v

----------------
{"name": "Invantive"}
{"name": null}
```
The following example retrieves the JSON representation of a date/time:
```sql
select jsonencode(sysdateutc)

----------------
"2026-06-09T11:14:32.4407146Z"
```

