Beautifier JSON

Réindente le code pour le lire ; ne remplace pas les tests d’exécution.

Entrée: TexteRésultat: Texte

Saisie de texte

Exécuter pour voir le résultat

Exemples

Format an invoice identifier without changing its digits

Entrée

{"invoice_id":9007199254740995}

Expected answer

{
  "invoice_id": 9007199254740995
}
Indenter la chaîne
Trier les clés de l'objet
Off
Formaté
On
Keep a quoted invoice identifier as a string

Entrée

{"invoice_id":"9007199254740995"}

Expected answer

JSON
{
    "invoice_id": "9007199254740995"
}
Indenter la chaîne
Trier les clés de l'objet
Off
Formaté
On
Convert an annotated JSON5 request policy into strict JSON

Make the formatter's permissive input behavior visible, then check the output with a strict JSON parser.

Entrée

{ // Request policy
 timeoutMs: 5000,
 retries: 2,
}

Expected answer

JSON
{
    "timeoutMs": 5000,
    "retries": 2
}
Indenter la chaîne
Trier les clés de l'objet
Off
Formaté
On
A support ticket with a zero-prefixed identifier

Entrée

{"ticket":"00123","priority":"high"}

Expected answer

JSON
{
    "ticket": "00123",
    "priority": "high"
}
Indenter la chaîne
Trier les clés de l'objet
Off
Formaté
On
An observatory reading with a negative temperature

Entrée

{"station":"demo-observatory","temperatureC":-12.5,"open":false}

Expected answer

JSON
{
    "station": "demo-observatory",
    "temperatureC": -12.5,
    "open": false
}
Indenter la chaîne
Trier les clés de l'objet
Off
Formaté
On
A café menu with Unicode and a decimal price

Entrée

{"item":"café","price":3.5,"currency":"EUR"}

Expected answer

JSON
{
    "item": "café",
    "price": 3.5,
    "currency": "EUR"
}
Indenter la chaîne
Trier les clés de l'objet
Off
Formaté
On
A safe webhook retry policy

Entrée

{"timeoutMs":5000,"retries":2,"enabled":true}

Expected answer

JSON
{
    "timeoutMs": 5000,
    "retries": 2,
    "enabled": true
}
Indenter la chaîne
Trier les clés de l'objet
Off
Formaté
On
An image manifest with a null caption

Entrée

{"width":640,"height":480,"caption":null}

Expected answer

JSON
{
    "width": 640,
    "height": 480,
    "caption": null
}
Indenter la chaîne
Trier les clés de l'objet
Off
Formaté
On
A release note with an embedded newline

Entrée

{"version":"2.1.0","notes":"Fixed parser\nAdded tests"}

Expected answer

JSON
{
    "version": "2.1.0",
    "notes": "Fixed parser\nAdded tests"
}
Indenter la chaîne
Trier les clés de l'objet
Off
Formaté
On
An empty search result

Entrée

{"results":[],"total":0}

Expected answer

JSON
{
    "results": [],
    "total": 0
}
Indenter la chaîne
Trier les clés de l'objet
Off
Formaté
On

Outils associés

Nettoyage du code

Référence de l’opération

Voir la documentation technique originale (English)