---
title: "JSONFORMAT"
description: "La funci\u00F3n SQL JSONFORMAT da formato legible al texto JSON mediante sangr\u00EDa."
language: es
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/es/docs/invantive-universalsql/grammar/sql-functions/jsonformat
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/jsonformat
updated: 2026-12-04T13:52:01Z
license: https://documentation.invantive.eu/es/
---

## Sintaxis
```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))
```

## Propósito
La función SQL `JSONFORMAT` formatea el texto JSON utilizando sangría.

Véanse también [[JSONDECODE]], [[JSONELEMENT]], [[JSONENCODE]] y [[XMLFORMAT]].

Parámetros:
- Json (`varchar2`): texto JSON que se va a formatear.

Devuelve: el texto JSON formateado. Devuelve `null` cuando la entrada es `null` o está vacía.

## Ejemplos
El siguiente ejemplo formatea un texto JSON compacto:
```sql
select jsonformat('{"name":"peter","age":21}')

-------------------
{
  "name": "peter",
  "age": 21
}
```
El siguiente ejemplo formatea de forma legible un texto JSON compacto que contiene un array; cada elemento del array se coloca en su propia línea:
```sql
select jsonformat('{"name":"peter","tags":["sql","json"]}')

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

