JSONFORMAT
Sintassi
%%{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))
Scopo
La funzione SQL JSONFORMAT formatta il testo JSON utilizzando l'indentazione.
Vedi anche JSONDECODE, JSONELEMENT, JSONENCODE e XMLFORMAT.
Parametri:
- JSON (
varchar2): testo JSON da formattare in modo leggibile.
Restituisce: il testo JSON formattato in modo leggibile. Restituisce null quando l'input è null o vuoto.
Esempi
L'esempio seguente formatta in modo leggibile un testo JSON compatto:
select jsonformat('{"name":"peter","age":21}')
-------------------
{
"name": "peter",
"age": 21
}
L'esempio seguente formatta in modo leggibile un testo JSON compatto contenente un array; ogni elemento dell'array viene posizionato su una riga a sé stante:
select jsonformat('{"name":"peter","tags":["sql","json"]}')
-------------------
{
"name": "peter",
"tags": [
"sql",
"json"
]
}