0
I am layman still in language, I wanted JSON to be indented.
I have the text on one line:
[{"titulo":"teste","detalhes":"teste"}]
I wanted it this way:
[
{
"titulo": "teste",
"detalhes": "teste1"
}
]
That is the code:
var json = [];
json.push({
titulo: document.getElementById('iptTitulo').value,
detalhes: document.getElementById('iptDetalhes').value
});
document.getElementById('text-area').value = JSON.stringify(json);
And where is this JSON? What are you doing with it? How are you displaying?
– Woss
@Andersoncarloswoss posted code
– Jefferson Rudolf
It would be something like
JSON.stringify(json, null, '\t')
what you need?– Woss
@Andersoncarloswoss himself, thanks. It worked!
– Jefferson Rudolf