Toolivaro

Formatador e validador de JSON grátis

Formate e valide JSON com indentação legível, mensagens de erro precisas e estatísticas de tamanho em bytes — tudo local.

O formatador de JSON transforma JSON compactado ou quebrado à mão em uma saída legível com indentação de dois espaços e o valida ao mesmo tempo. Cole qualquer documento JSON — uma resposta de API, um arquivo de configuração ou um fixture de teste — e ele é analisado e impresso de forma legível na hora, com uma mensagem de erro clara e a posição do problema quando o documento é inválido. A ferramenta informa os tamanhos de entrada, formatado e minificado em bytes, para você ver exatamente quanto os espaços em branco custam, e oferece ações de copiar e baixar o resultado. Tudo roda localmente no seu navegador: o JSON colado nunca sai do seu dispositivo, nunca é registrado e nunca é enviado a lugar nenhum — o que importa quando o documento contém tokens, chaves privadas ou dados pessoais. A validação segue a semântica de JSON.parse, então a ferramenta aceita exatamente o que a plataforma aceita (RFC 8259, incluindo strings, números, arrays, objetos e null). Use esta ferramenta ao depurar uma resposta de API, revisar um arquivo de configuração ou preparar JSON para um pull request.

Processado localmente no seu navegador

Processado localmente no seu navegador — o JSON colado nunca é enviado, registrado ou armazenado.

Como usar esta calculadora

When the JSON formatter earns its place

Every developer has hit the wall of a single-line API response: hundreds of characters of JSON with no whitespace, and the one field you need hiding somewhere in the middle. That is the formatter’s home turf. Paste the response in, and the tool re-indents every object and array with two spaces so the structure becomes visible at a glance — which property lives in which object, and how deep the nesting goes. The same action validates the document, so a config file you edited by hand is checked for grammar at the same time. Reviewing a pull request? A formatted copy makes the diff legible instead of a wall of text. Extracting an error payload from a failed request? Same flow. Because everything runs locally, this is also the safe option for documents that carry API tokens, private keys, or personal data — nothing is uploaded, logged, or stored, so you can format a credential-bearing fixture without shipping it anywhere.

The tool is deliberately strict: it accepts standard JSON only, with the same grammar the browser’s JSON.parse accepts. That strictness is the feature. A document that parses here will parse in any JavaScript runtime, in Node, and in most CI tooling — which makes the tool a cheap pre-commit gate. It is equally useful the other way around: when a server or a script hands you JSON that fails to parse, the formatter tells you exactly where the grammar breaks, so you can fix the source rather than the symptom. Keep it in mind whenever you copy JSON out of a database, a generated file, or an email and want to know it is intact before it goes anywhere. If your text is close to JSON but not JSON — YAML, JSON5, a config file with comments — this is the wrong tool, and it will tell you so.

Formatting a document, step by step

Open the tool and paste your JSON into the input textarea — that is the only required field. Then click Format. If the document is valid, the formatted result appears in the output box below, indented with two spaces, and the stats row under it reports the input size, line count, minified size, and formatted size in bytes. Two further actions matter. Validate checks grammar without producing output — the answer you want when you only need a yes-or-no before committing a file. Clear empties both boxes and returns focus to the input, which is faster than selecting text by hand between runs. Once you are happy, Copy puts the formatted text on your clipboard, and Download saves it as a .json file named toolivaro-format.json — handy when you want to drop a cleaned-up fixture into a repository or an issue.

The most common missteps show up immediately. Paste nothing and click Format, and the tool answers with “Paste some JSON first.” — a gentle nudge rather than an error. Paste invalid JSON, and no output is produced; instead the tool reports the parser’s message with a position, like (position 66), so you can find the exact character that breaks the grammar. Trailing commas, single-quoted strings, unquoted keys, and comments are all rejected on purpose — this tool does not guess what you meant the way a permissive formatter might. Expect two-space indentation only; there is no setting for tabs or four spaces in this version. And remember that the input box accepts whatever you paste, so confirm you pasted the whole document — truncating a large response at the start or end produces a validation error that is really a copy problem.

Two details make the workflow predictable. The tool keeps no history between visits: there is no autosave, no paste log, and nothing survives a page reload — open the page, format, close, and the document is gone with the tab. That is intentional and worth leaning on: it makes the formatter safe to use with tokens or private keys without worrying about a browser-stored copy of them. And the Copy action writes exactly what the output box shows, so what you paste elsewhere is what you saw on screen — the formatted document, nothing re-validated or re-indented behind your back. Download saves the same content to a file, which is the cleanest way to hand a cleaned-up fixture to a repository or an issue.

Reading the output, the stats, and the errors

The output box holds the formatted document: one property per line, nested objects and arrays indented two spaces per level, and every string, number, and boolean exactly as it was in the input. Formatting never changes the data — for valid JSON the parse-and-re-stringify round trip is lossless, so the formatted copy is the same document with whitespace added. The stats row tells you what readability costs: “Input 61 B · 1 line · minified 61 B (−0%) · formatted 78 B” means the compressed form is 61 bytes and the pretty form 78. The size-comparison bars show the same relationship visually, scaling both against the larger. A gap of 17 bytes on a small payload is nothing; on a big API payload, minified output can matter for storage or transfer budgets — which is why the tool always shows both.

Errors are the other half of reading the output. When the parser rejects the document, the tool shows the engine’s message plus a position — “Expected double-quoted property name in JSON at position 66 (position 66)” for a trailing comma, for instance — and marks the input as invalid. The exact wording comes from the browser’s own JSON parser, so it can differ slightly across engines, but the position always points at the character where parsing stopped. Two limits are worth knowing. First, validation is grammatical, not semantic: a document that parses can still be wrong for your application — the wrong key, the wrong type — and no tool can catch that for you. Second, documents of hundreds of megabytes will slow the browser, so the tool is designed for typical configs and API payloads rather than database dumps.

Como o resultado é calculado?

Formatando uma resposta de API compactada

Uma API retorna {"status":"ok","items":[{"id":1,"name":"A"},{"id":2,"name":"B"}]}. O formatador produz uma propriedade por linha com indentação de dois espaços, deixando o aninhamento visível de relance. O painel de estatísticas mostra que a entrada tem 68 bytes enquanto a versão formatada tem 101 bytes — o custo dos espaços em branco pela legibilidade.

Exemplo de entrada e saída
Entrada Valor
json {"status":"ok","items":[{"id":1,"name":"A"},{"id":2,"name":"B"}]}
Resultado JSON válido · formatado com indentação de 2 espaços · entrada 68 B → formatado 101 B

Formatting a Unicode-heavy API response

A weather service returns conditions for several cities in a single minified line, including names in their local spellings: München, José, and a fire emoji for the alert level. Pasted as-is, the payload is one dense line, and the accented characters make it easy to lose your place. Format the payload and the tool expands it to one property per line, so the four fields — city, temp, emoji, name — become instantly readable. The stats row then tells a story that surprises people the first time: the input weighs 61 bytes but is only 57 characters. Bytes are like postage stamps: a letter’s weight depends on the characters inside it, not just on how many there are. The ü in München takes two bytes, the é in José two, and the fire emoji four, while plain ASCII letters take one each. The formatted copy comes in at 78 bytes, all of it readable UTF-8. That distinction matters in practice: when you minify and store the payload later, byte size — not character count — is what your database column and your transfer limits see. The stats row shows both figures side by side, so you can weigh readability against size before the result goes anywhere. The example also shows validation passing silently: the payload parses on the first Format click, so the tool goes straight to output, and a quick Copy drops the readable version into a ticket or a pull request description. No settings are needed, and there is nothing to configure: paste, format, read the stats, copy. That one-click round trip is the point of a local utility.

Exemplo de entrada e saída
Entrada Valor
json {"city":"München","temp":23.5,"emoji":"🔥","name":"José"}
Resultado Valid JSON · formatted with 2-space indent · input 61 B → formatted 78 B

Tracking down a validation error after a hand edit

Hand-editing a generated config file — an environment file listing services and deployment regions — is where trailing commas sneak in. You add one more region to the array and, out of habit, leave the comma that used to precede the closing bracket: the array now ends with a comma, then a brace. The formatter refuses to produce output and instead reports the parser’s message with a position: “Expected double-quoted property name in JSON at position 66 (position 66)”. Read it like a copy editor proofreading a headline twice: the message names the exact problem, and the position pinpoints it. The parser reached the end of the array, found a comma, then found the closing brace where another property name should have been. Position 66 is where that unexpected brace sits, counting characters from the start of the document, and the stray comma at position 65 caused it — delete the comma and the document parses. The tool marks the input as invalid and leaves the output box empty, so there is no half-formatted result to mislead you. The fix is mechanical, not a hunt: go to the reported character, look one step back for the stray punctuation, and remove it. Validate is the cheap way to run this check without reformatting anything: click Validate, see the error, fix the text, click again, and the tool answers “Valid JSON.” That loop — paste, validate, fix, validate — is the fastest way to clean up hand-edited configuration before it goes anywhere near a server, and it works for any of the classic grammar slips: trailing commas, single quotes, unquoted keys, comments. The error message always tells you where to look, never just that something is wrong.

Exemplo de entrada e saída
Entrada Valor
json {"service":"api","env":"prod","regions":["us-east-1","eu-west-1"],}
Resultado Invalid JSON — Expected double-quoted property name in JSON at position 66 (position 66)

Qual é a fórmula e suas premissas?

Método de formatação

format(json) = JSON.stringify(parse(json), null, 2)

Termos da fórmula
Símbolo Significado
parse parser JSON padrão (semântica RFC 8259)
null, 2 sem replacer; indentação de dois espaços

Formatar nunca altera os dados — analisar e re-serializar é um ciclo sem perdas para JSON válido.

Validação

valid ⇔ parse(json) succeeds

Termos da fórmula
Símbolo Significado
valid JSON gramaticalmente correto conforme RFC 8259

JSON sintaticamente válido ainda pode estar semanticamente errado para a sua aplicação — a validação verifica a gramática, não o significado.

Quais são os erros mais comuns?

  • Colar JSON com vírgulas no final ou comentários e esperar que ele seja analisado — o JSON padrão rejeita ambos.
  • Tratar validade sintática como correção semântica: um documento válido ainda pode falhar no schema da sua aplicação.
  • Formatar dados sensíveis com uma ferramenta online que os envia — esta ferramenta nunca envia nada a lugar nenhum.

Quais são as premissas e limitações?

  • A validação é gramatical (RFC 8259), não semântica — ela não consegue avaliar se os dados correspondem ao seu schema.
  • Documentos muito grandes (centenas de MB) podem deixar o navegador lento; a ferramenta foi feita para configurações e payloads de API típicos.
  • A saída usa apenas indentação de dois espaços; outros estilos de indentação não são configuráveis na versão 1.

De onde vêm os números?

Última revisão 12 de agosto de 2026 · Versão 1.1.0 · Toolivaro não garante conteúdo externo.

Perguntas frequentes

Formatar é seguro para JSON com chaves duplicadas?

O parser mantém o último valor de uma chave duplicada (comportamento padrão do JSON), e o formatador preserva exatamente o que o parser aceitou. Se chaves duplicadas importam para você, valide com seu próprio schema — o próprio JSON não as proíbe.

Por que meu JSON falha na validação?

Causas comuns: vírgulas no final, strings entre aspas simples, chaves sem aspas, comentários e lixo depois do fim do documento. A mensagem de erro inclui a posição do parser quando disponível, para você pular direto para o problema.

Esta ferramenta suporta JSON5 ou YAML?

Não — esta ferramenta aceita apenas JSON padrão. Comentários e vírgulas no final são recursos do JSON5 e são rejeitados de propósito; use um conversor dedicado para esses formatos.

Why do the byte counts look higher than my character count?

Because bytes and characters are not the same thing. The tool measures size in UTF-8 bytes: ASCII letters and digits take one byte each, while accented characters like ü or é take two, and emoji take four. A 57-character document can therefore weigh 61 bytes. The byte figure is what storage and transfer limits actually use, so it is the honest number to compare.

What is the difference between Format and Validate?

Format parses the document, checks the grammar, and writes the pretty-printed result into the output box with full size stats. Validate runs the same parse but reports only a verdict — “Valid JSON.” or an error with position — and leaves the output box untouched. Use Validate when you want a quick check without reformatting, for example before committing a config file you already formatted.

How large a document can I format?

There is no hard cap, but the tool parses synchronously in the browser, so very large documents — hundreds of megabytes — will slow the page and may freeze the tab for a while. It is designed for typical configs and API payloads. For multi-gigabyte dumps, use a streaming parser in a script instead; anything you can paste, this tool handles.

Parte de Kit de ferramentas de texto e JSON para desenvolvedores

Encontrou um erro ou tem uma correção? Informe — revisamos toda correção.

Foi útil?

Revisado pela equipe editorial da Toolivaro conforme nossa metodologia Metodologia · Política editorial