---
title: "JSONFORMAT"
description: "The JSONFORMAT SQL function pretty-prints JSON text using indentation."
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/jsonformat
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/jsonformat
updated: 2026-08-09T00:00:00Z
license: https://documentation.invantive.eu/en/
---

## Syntax
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> JSONFORMAT[JSONFORMAT]:::quoted
    JSONFORMAT --> End((END))
```

## Purpose
The `JSONFORMAT` SQL function pretty-prints JSON text using indentation.

See also [[JSONDECODE]], [[JSONELEMENT]], [[JSONENCODE]] and [[XMLFORMAT]].

Parameters:
- Json (`varchar2`): JSON text to pretty-print.

Returns: the pretty-printed JSON text. Returns `null` when the input is `null` or empty.

## Examples
The following example pretty-prints a compact JSON text:
```sql
select jsonformat('{"name":"peter","age":21}')

-------------------
{
  "name": "peter",
  "age": 21
}
```
The following example pretty-prints a compact JSON text containing an array; each array element is placed on its own line:
```sql
select jsonformat('{"name":"peter","tags":["sql","json"]}')

-------------------
{
  "name": "peter",
  "tags": [
    "sql",
    "json"
  ]
}
```