JSON Formatter

Entrée JSON

1

Sortie JSON

Paramètres

Commencer à formater du JSON

Saisissez du JSON à gauche ou utilisez Importer pour charger depuis un fichier.

Beautify, minify, validate, escape, and unescape JSONChoose 2-space, 4-space, or sorted-key outputEverything stays local in your browser

Comment formater et valider du JSON

1Étape 1 – Collez ou importez votre JSON dans le formateur en ligne2Étape 2 – Choisissez les options de formatage3Étape 3 – Vérifiez le résultat et les éventuelles erreurs4Étape 4 – Copiez ou téléchargez pour votre API, vos réponses ou vos logs

A reliable formatter workflow is simple: paste the raw payload, choose whether you need readable or compact output, review parse errors if any, then copy, download, or continue into repair, table editing, or schema generation.

From one-line payload to readable structure

Expand raw JSON before you validate, diff, or edit it

A lot of real payloads come from logs, APIs, and queues as a single unreadable line. The formatter turns that into something you can inspect in seconds.

Raw input
1
{"orderId":"SO-1024","customer":{"name":"Maeve","tier":"gold"},"items":[{"sku":"A-1","qty":2},{"sku":"B-8","qty":1}],"paid":true}
Formatted output
1
{
2
"orderId": "SO-1024",
3
"customer": {
4
"name": "Maeve",
5
"tier": "gold"
6
},
7
"items": [
8
{
9
"sku": "A-1",
10
"qty": 2
11
},
12
{
13
"sku": "B-8",
14
"qty": 1
15
}
16
],
17
"paid": true
18
}

Use pretty output for review and debugging. Switch to minified output only when you need compact transport or storage.

3 practical formatter examples

These are the common cases where formatting pays off immediately during real development work.

API response

Turn a one-line response into something you can inspect

Useful when you need to confirm fields, nested objects, arrays, and unexpected values quickly.

JSON d’entrée
1
{"user":{"id":42,"name":"Maeve"},"roles":["admin","editor"],"flags":{"beta":true,"suspended":false}}
JSON formaté
1
{
2
"user": {
3
"id": 42,
4
"name": "Maeve"
5
},
6
"roles": [
7
"admin",
8
"editor"
9
],
10
"flags": {
11
"beta": true,
12
"suspended": false
13
}
14
}

Readable structure is usually the fastest way to spot field-level mistakes in API data.

Config diff

Sort keys before comparing environment config

Stable key order makes diffs cleaner and reduces noise when reviewing configuration changes.

JSON d’entrée
1
{
2
"retry": 3,
3
"apiBase": "https://api.example.com",
4
"features": {
5
"betaCheckout": true,
6
"abTest": false
7
},
8
"timeout": 8000
9
}
JSON formaté
1
{
2
"apiBase": "https://api.example.com",
3
"features": {
4
"abTest": false,
5
"betaCheckout": true
6
},
7
"retry": 3,
8
"timeout": 8000
9
}

Sorting is useful when your real goal is comparison rather than human-friendly business ordering.

Escaped payload

Unescape a JSON string before editing it

Logs and message systems often store JSON inside strings. Unescape it first, then keep working on the actual structure.

JSON d’entrée
1
"{\"event\":\"login\",\"user\":{\"id\":42,\"name\":\"Maeve\"},\"success\":true}"
JSON formaté
1
{
2
"event": "login",
3
"user": {
4
"id": 42,
5
"name": "Maeve"
6
},
7
"success": true
8
}

If the payload is full of backslashes, unescaping is usually the first useful step.

  1. 01

    Tutorial Step

    Étape 1 – Collez ou importez votre JSON dans le formateur en ligne

    Start with the original payload. You do not need to clean up spacing or line breaks first.

    • Collez le JSON brut dans l’éditeur de gauche depuis n’importe quelle source (réponse API, fichier de configuration, journaux, etc.).
    • Ou utilisez Importer pour charger du JSON depuis un fichier, une URL ou des données d’exemple.
    • Cet outil agit comme un formateur JSON en ligne pour nettoyer rapidement du JSON désordonné.
    • Single-line JSON is fine. The formatter can expand it into a readable structure for you.
    • When several people need to review the same payload, keep the original input intact and format it here instead of editing it by hand first.
  2. 02

    Tutorial Step

    Étape 2 – Choisissez les options de formatage

    Readable JSON and compact JSON solve different problems. Pick the mode that matches what you need next.

    • Sélectionnez la taille d’indentation (2 espaces, 4 espaces ou compact).
    • Optionnel : triez les clés par ordre alphabétique pour normaliser la structure entre payloads.
    • Passez en sortie minifiée lorsque vous avez besoin d’un JSON compact pour les API, le stockage ou la production.
    • Use Escape when you need a JSON string literal, for example inside logs or nested config values.
    • Use Unescape when the input is an escaped JSON string and you want the plain text back.
  3. 03

    Tutorial Step

    Étape 3 – Vérifiez le résultat et les éventuelles erreurs

    The output area is both a result view and a fast feedback loop. Valid JSON renders immediately; invalid JSON shows an actionable error.

    • Consultez le JSON formaté à droite avec coloration syntaxique et indentation cohérente.
    • Surveillez les erreurs de parsing (par exemple, virgules ou guillemets manquants).
    • Utilisez cette page comme une vérification rapide de la syntaxe JSON pendant le formatage.
    • If the payload is too broken to fix quickly, move it straight to the Repair tool.
    • When the data contains nested escaped JSON, unescape it first so the real structure becomes visible.
  4. 04

    Tutorial Step

    Étape 4 – Copiez ou téléchargez pour votre API, vos réponses ou vos logs

    Once the JSON is clean, use it as the working copy for the next step instead of repeating the cleanup elsewhere.

    • Utilisez Copier pour envoyer le JSON formaté dans votre presse-papiers.
    • Téléchargez le résultat sous forme de fichier .json pour des requêtes API, des réponses API ou des instantanés de journaux.
    • Réutilisez le même JSON formaté comme source propre pour la documentation ou des exemples de code.
    • Move the cleaned JSON into the table editor when field-level review is easier in rows and columns.
    • Generate a schema from the cleaned payload when the next step is validation, documentation, or code generation.

A common formatter workflow

1

Paste the raw payload into the formatter and expand it into readable JSON first.

2

If the parser fails, jump to the error or move the payload into Repair.

3

Once the structure is valid, choose beautified, minified, escaped, or unescaped output based on the next task.

4

Apply the output back to input if the cleaned result should become your new working copy.

5

Continue into the table editor, compare tool, or schema generator when formatting is no longer the bottleneck.

Putting the formatter at the front of the workflow usually saves time later because every downstream tool receives cleaner JSON.

Conseils rapides pour débuter

La plupart des erreurs JSON viennent de virgules manquantes, de virgules finales en trop ou de l’utilisation de guillemets simples au lieu de guillemets doubles.
Si tout apparaît sur une seule longue ligne, formatez d’abord, puis corrigez les erreurs indiquées au-dessus.
Utilisez du JSON formaté pour le débogage et passez en JSON minifié pour les payloads de production.

Outils JSON associés

  • Validez le JSON avant ou après le formatage pour détecter tôt les erreurs de syntaxe.
  • Réparez un JSON cassé qui ne peut pas être analysé, puis repassez-le dans le formateur.
  • Générez des schémas et des types à partir d’un JSON propre pour la validation et du code typé.

Questions fréquentes

À quoi sert le formatage JSON ?

Le formatage JSON rend vos données plus lisibles en ajoutant une indentation, des retours à la ligne et un espacement appropriés.

Puis-je personnaliser l’indentation ?

Oui. Vous pouvez choisir 2 espaces, 4 espaces ou une sortie compacte (minifiée).

Le formatage va-t-il modifier mes données ?

Non. Le formatage ne change que la présentation ; la structure et les valeurs restent identiques.

Puis-je formater de gros fichiers JSON ?

Oui. Le formateur gère bien les JSON volumineux, mais les très gros fichiers peuvent prendre quelques instants à traiter.

What is the difference between formatting and validation?

Formatting focuses on readability, while validation focuses on syntax correctness. This page does both in one flow.

Is my JSON uploaded to a server?

No. Formatting, validation, escaping, and unescaping all run locally in your browser.