Ir al contenido principal
Develop Tools
← Volver a la guía de uso

How to format and compress JSON and check syntax errors

Settings

Process of inputting JSON, formatting or compressing it after checking the syntax, and saving it
Process of inputting JSON, formatting or compressing it after checking the syntax, and saving it

When this guide is useful

This is for users who want to perform JSON formatting, JSON Formatter, JSON compression, JSON syntax checking, and checking JSON error lines in their browser.

  • Indent and review API responses
  • Locate syntax errors in configuration files
  • Compress JSON into one line and paste into test data

Points to check before formatting JSON

  • Enclose JSON keys and strings in double quotes
  • Comments and trailing commas are not used in standard JSON
  • Check the line break code and indent width required by the API or setting destination.
  • Integers that exceed the JavaScript Number range are treated with lexical retention

Steps to format and compress JSON

  1. Paste the JSON or select and drop the .json file.
  2. Perform a syntax check and correct any errors by navigating to the rows and columns that appear.
  3. Select and format indent width, LF/CRLF, and trailing line feed.
  4. Copy

Convert

Depending on the JSON consumer, only the beginning or end of duplicate keys may be accepted. This tool does not delete the values ​​and warns you, so the user should confirm which ones to keep.

JSON5, JavaScript objects, and YAML have different syntax than standard JSON. For input containing comments or single quotes, use the conversion procedure that supports that format.

Specific example: Correcting syntax errors in API responses and sharing them

When editing API responses manually, it's easy to insert trailing commas or missing closing parentheses. It's important to check the error rows and columns and not guess at multiple locations at once.

After modification, formatting with 4 spaces makes it easier to review the hierarchy of objects and arrays.

  1. Paste the response JSON into the input field.
  2. Performs a syntax check and moves to the first error.
  3. Correct any errors and check the syntax again.
  4. Format with 4 spaces/LF, copy and share the result.

For JSON containing API keys, access tokens, and customer information, use a JSON masking tool to replace sensitive values before sharing.

Frequently asked questions

Can the ending of a large integer change?
Since the original lexical value is maintained without converting the number to a JavaScript Number, the integer is not rounded due to formatting and compression.
Input
Select

Probar en el navegador

Los datos introducidos se procesan en el navegador. Conserve los datos originales y revise el resultado antes de guardarlo o compartirlo.

Open JSON formatting/compression/syntax checking tool