Formateador JSON

Formatea JSON, valida su estructura y minifica la salida.

// about

Sobre esta herramienta

El texto JSON puede ser difícil de leer si está apretado. Esta herramienta añade saltos de línea y sangrías para ordenarlo fácilmente.

Cómo usarla

  1. Pega tu texto JSON en la casilla superior.
  2. Haz clic en 'Ejecutar' o marca 'Minificar' si prefieres la versión compacta.
  3. Copia el resultado limpio y úsalo donde quieras.

Por qué usar esta herramienta

  • Ordena el JSON de forma clara con un solo clic.
  • Encuentra al instante comas o comillas faltantes.
  • Permite minificar el texto para enviar datos más rápido.

Preguntas frecuentes (FAQ)

¿Qué es JSON?

JSON es una forma sencilla en que las computadoras comparten datos usando llaves y comillas.

¿Se guardan mis datos en el servidor?

¡No! Todo se procesa en tu navegador web y nadie más puede verlo.

¿Qué hago si sale un error?

Revisa si falta alguna comilla o coma en el texto que pegaste.

Guías · Datos · 8 min de lectura

Corregir errores de sintaxis JSON: los 7 fallos más comunes y cómo ordenar un JSON

Respuestas de API, archivos de configuración, registros: JSON es el formato de datos que más leen los desarrolladores. Aun así, una sola coma o comilla puede provocar un error «Unexpected token». Así puedes encontrar la causa rápidamente.

JSON (JavaScript Object Notation) es un formato de texto estandarizado en la RFC 8259 y ECMA-404. Nació de JavaScript, pero hoy lo admiten casi todos los lenguajes. Solo hay seis tipos de valor: cadena, número, booleano (true/false), null, array y objeto.

{
  "id": 1024,
  "name": "AIBIZAP",
  "active": true,
  "tags": ["tools", "guides"],
  "owner": null
}
Conceptos básicos de JSON, siete errores de análisis frecuentes, trampas con números grandes y fechas, y cómo convertir JSON en clases o tablas.
Leer guía →
Créalo con IA

Crea esta herramienta tú mismo con IA

¿Quieres tu propia versión? Copia el prompt en un chat de IA o guarda el archivo de skill para un agente de programación. Incluyen las funciones, casos límite y pruebas que usamos al crearla.

El prompt y la skill están en inglés, que las herramientas de IA entienden perfectamente.

Prompt de instrucciones para IA

Pégalo tal cual en Claude, ChatGPT o Gemini.

You are an experienced full-stack web developer. Build a web tool called "Formateador JSON" that meets the requirements below.

## Goal

Build a tool that validates JSON and pretty-prints or minifies it.

## Core features

- Validation with error line and column
- Indent with 2 spaces, 4 spaces or tabs
- Minify mode
- Optional alphabetical key sorting
- Copy result and download as .json

## Inputs

- JSON text
- Indentation, sorting and mode options

## Outputs

- Formatted or minified JSON
- Error message with position

## Edge cases and handling rules

- Explain common errors such as trailing commas, single quotes and comments in plain language
- Preserve integers larger than 2^53 exactly
- Strip a leading BOM
- Stay responsive with multi-megabyte input

## Implementation requirements

- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.

## Definition of done (test cases)

- '{"a":1,}' is reported as a trailing comma error
- Formatting then minifying keeps the same meaning
- 12345678901234567890 is preserved

First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.

Skill (SKILL.md)

Guárdalo como .claude/skills/build-json-formatter/SKILL.md para que agentes como Claude Code lo reutilicen cada vez que crees o cambies la herramienta.

---
name: build-json-formatter
description: Use when building or changing a Formateador JSON tool. Build a tool that validates JSON and pretty-prints or minifies it.
---

# Build: Formateador JSON

## Goal

Build a tool that validates JSON and pretty-prints or minifies it.

## Workflow

1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.

## Core features

- Validation with error line and column
- Indent with 2 spaces, 4 spaces or tabs
- Minify mode
- Optional alphabetical key sorting
- Copy result and download as .json

## Inputs

- JSON text
- Indentation, sorting and mode options

## Outputs

- Formatted or minified JSON
- Error message with position

## Rules

- Explain common errors such as trailing commas, single quotes and comments in plain language
- Preserve integers larger than 2^53 exactly
- Strip a leading BOM
- Stay responsive with multi-megabyte input
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.

## Verification

- [ ] '{"a":1,}' is reported as a trailing comma error
- [ ] Formatting then minifying keeps the same meaning
- [ ] 12345678901234567890 is preserved

Consejos para trabajar con IA

  • Indica tu stack (React, Vue o HTML puro) en la primera línea para obtener código adecuado.
  • Pide que ejecute las pruebas listadas y muestre los resultados antes de aceptar el código.
  • No pegues contraseñas reales, datos de clientes ni claves de API; usa valores de ejemplo.