منسق JSON
نسق وصغر وتحقق من بيانات JSON مع تمييز بناء الجملة.
How to Use the JSON Formatter
- Paste your JSON — Copy JSON data from an API response, file, or code editor and paste it into the input area.
- Choose indent size — Select 2, 4, or 8 spaces (or tab) from the dropdown to set your preferred indentation level.
- Prettify — Click the Prettify button to format your JSON with proper indentation and line breaks for easy reading.
- Minify — Click Minify to remove all whitespace and compress your JSON into a single line for production use.
- Validate — Click Validate to check if your JSON syntax is correct. Error messages will help you locate and fix issues.
About JSON Formatter
This free online JSON formatter lets you prettify, minify, and validate JSON data instantly. JSON (JavaScript Object Notation) is the most widely used data interchange format on the web, used by REST APIs, configuration files, databases like MongoDB, and virtually every modern web application.
Working with raw or minified JSON is difficult to read and debug. This formatter adds proper indentation, line breaks, and structure so you can quickly understand nested objects and arrays. Conversely, the minify function strips all unnecessary whitespace to produce the smallest possible payload for API responses and data storage.
The built-in validator checks your JSON against the official specification (RFC 8259) and provides clear error messages when syntax issues are found. Common issues like trailing commas, missing quotes, and single-quoted strings are detected instantly. All processing runs locally in your browser, so sensitive API data and configuration files are never sent to any external server.
Frequently Asked Questions
What is the difference between prettify and minify JSON?
Prettify (also called "beautify") adds indentation and line breaks to make JSON human-readable. Minify removes all unnecessary whitespace to reduce file size, which is ideal for production APIs and data transfer where smaller payloads improve performance.
How do I validate JSON online?
Paste your JSON into the input field and click the Validate button. The tool will check whether the JSON syntax is valid and display a success or error message. If there are errors, it will indicate what went wrong to help you fix the issue.
What causes "invalid JSON" errors?
Common causes include: trailing commas after the last item in an array or object, single quotes instead of double quotes around keys and strings, missing quotes around keys, unescaped special characters in strings, and comments (JSON does not support comments).
Can I change the indentation level when formatting JSON?
Yes. You can choose between 2 spaces, 4 spaces, 8 spaces, or 1 tab for indentation. The default is 2 spaces, which is the most common convention in web development. Select your preferred indent level from the dropdown before clicking Prettify.
Is there a size limit for JSON formatting?
Since all processing happens in your browser, the limit depends on your device's available memory. Most modern browsers can handle JSON files of several megabytes without issues. For extremely large files (50MB+), a desktop application may perform better.