Minificador y Embellecedor de JSON
Formatee JSON con resaltado de sintaxis o elimine espacios en blanco para minificar — con validación en tiempo real y estadísticas de tamaño.
Acerca de esta herramienta
Alterne entre los modos Embellecer y Minificar: Embellecer formatea su JSON con sangría de 2 o 4 espacios y resaltado de sintaxis con código de colores; Minificar elimina todos los espacios en blanco innecesarios para cargas de producción. La conversión ocurre en tiempo real a medida que escribe. La herramienta informa el tamaño original, el tamaño de salida y el cambio porcentual, y cualquier error de JSON se marca con un número de línea y columna exactos.
Cómo usar
- 1 Pegue o escriba su JSON en el panel de entrada izquierdo.
- 2 Haga clic en 'Embellecer' para formatear con sangría y resaltado de sintaxis, o en 'Minificar' para eliminar espacios en blanco.
- 3 Verifique la barra de estadísticas de tamaño para ver el tamaño original, el tamaño de salida y el cambio porcentual.
- 4 Si hay errores, lea el indicador de línea/columna en el banner de error y corrija el JSON en el panel de entrada.
What minification actually removes
JSON minification is the process of stripping every byte that a parser does not need. Human-readable JSON is padded with whitespace for our benefit: line breaks after each property, two or four spaces of indentation per nesting level, and a space after every colon and comma. None of that affects the data. A minifier parses the JSON into a real object and then re-serialises it with zero formatting, so { "name": "Alice", "age": 30 } spread across several indented lines collapses to the single string {"name":"Alice","age":30}. The values are byte-for-byte identical; only the cosmetic spacing is gone.
This tool does both directions. Minify produces the compact form. Beautify does the reverse — re-indenting with your choice of 2 or 4 spaces and syntax-highlighting keys, strings, numbers, and literals — for when you receive a dense blob and need to read it.
Where the savings come from — a worked example
Indentation is the biggest source of bloat, and it compounds with depth. Consider a config with nested objects:
{
"server": {
"host": "localhost",
"port": 8080
}
}
That pretty version is 64 bytes. Minified, it becomes {"server":{"host":"localhost","port":8080}} — 43 bytes, a 33% reduction. The tool measures this for you: after each operation a stats line shows input size, output size, and the percentage change. Minifying turns the percentage green and negative (smaller); beautifying turns it red and positive (larger), because re-adding indentation grows the file. The byte counts use UTF-8 encoding, so multi-byte characters are counted accurately rather than as one byte each.
| Form | Bytes (example) | Use it for |
|---|---|---|
| Pretty, 4-space | Largest | Reading, code review, diffs |
| Pretty, 2-space | Medium | A compromise for committed config files |
| Minified | Smallest | Network transfer, storage, embedding |
Why minified JSON matters in production
On a busy API, those saved bytes repeat on every single request. Trimming 20–40% off each JSON response reduces bandwidth costs and shortens transfer time, which is felt most on mobile connections. Minified JSON is the right form for anything that travels over the wire or gets stored at scale: API payloads, data embedded in HTML, records in a cache or database column, and configuration shipped inside a bundle. In real deployments minified JSON is then usually compressed with gzip or brotli on top, and the two stack — minification removes structural whitespace, compression removes statistical redundancy.
Practical tips
- Minify for machines, beautify for humans. Commit and ship the compact form; expand it only when you need to read or debug it. This tool lets you flip between the two instantly.
- Validate while you minify. Because the tool parses before re-serialising, invalid JSON cannot be minified — a malformed input is caught here, which doubles the tool as a quick syntax check.
- Use the error location. When parsing fails, the banner reports the line and column of the problem (derived from the parser's character position), so you can jump straight to the stray comma or unquoted key.
- Pick 2-space for diffs. If the JSON lives in version control, 2-space beautified output keeps line diffs readable while staying smaller than 4-space.
Common mistakes
- Expecting key names or values to shrink. Minification only removes whitespace; it never renames keys or alters data. The string
"description"stays exactly that. If you need smaller keys, that is a schema change, not minification. - Trying to minify JSON with comments or trailing commas. Standard JSON allows neither. A trailing comma or a
//comment will fail parsing — strip those first. - Assuming minified JSON is unreadable forever. It is fully reversible. Paste any compact JSON back in and Beautify restores readable, highlighted formatting with no data loss.
- Worrying about precision. Re-serialising can normalise number formatting (for example, dropping a redundant trailing zero), but the numeric value is preserved.
Everything runs in your browser
Your JSON is parsed and re-serialised entirely on your own device using the browser's native JSON engine — nothing is uploaded, logged, or stored on a server. That makes it safe to minify configuration containing internal hostnames, tokens, or proprietary data. You can confirm it by going offline: both Minify and Beautify keep working, because there is no network step involved.
Preguntas frecuentes
Formatea, valida y minifica JSON — con señalización exacta de errores de sintaxis.
Valide la sintaxis YAML y conviértala a JSON formateado — completamente en su navegador.
Referencia interactiva de expresiones regulares con pruebas de patrones en vivo y resaltado de coincidencias.