JSON formatter & validator — with the exact error line
Paste messy or minified JSON to beautify it, check that it is valid, or minify it for production. When something is wrong, the JSON validator shows the line, the column and the reason. Everything runs in your browser.
Everything happens in your browser with JavaScript. Nothing you paste is sent to HostKarle or anyone else, so it is safe for API responses, config files and other private data. Shortcut: Ctrl + Enter runs the tool.
How to use the JSON formatter
Minified API responses are impossible to read and one stray comma breaks a whole config file. The formatter fixes the first and finds the second.
Paste the JSON
Paste an API response, a composer.json or package.json, or load a file. Try "Broken sample" to see how errors are reported.
Format or minify
Format adds line breaks and indentation; Minify strips every space that is not inside a string. Tick "Sort keys" to order keys alphabetically.
Fix, copy, download
Valid JSON gets a green tick with its size. Invalid JSON shows the line, column and reason, so you can fix it and press Format again.
Frequently asked questions
Something not working the way you expect? Message us on WhatsApp at +91 94343 44325. We are a hosting company, so we answer developer questions too.
How do I format JSON online?
Paste the JSON into the left box and press Format. The formatter checks it, then prints it on the right with one key per line and the indentation you picked (2 spaces, 4 spaces or tabs). Press Minify for the shortest one-line version instead.
How do I find the error in my JSON?
Press Format. If the JSON is invalid, the red box names the line and column where it breaks, shows that line with a caret under the problem, and says what is wrong in plain words, for example "Trailing comma before } is not allowed" or "Expected ',' or '}' after a value. A comma may be missing."
What are the most common JSON mistakes?
A comma after the last item, single quotes instead of double quotes, keys without quotes, comments (JSON has none), a missing comma between two values, and values like undefined or NaN. These are all valid in JavaScript but not in JSON, which is why copied code often fails.
Is it safe to paste API responses or secrets here?
Yes. The formatter is JavaScript that runs in your own browser. The JSON is never uploaded to HostKarle or anywhere else. You can disconnect from the internet after the page loads and it still works.
What does "Sort keys" do?
It orders every object's keys alphabetically, at every level. That makes two JSON files easy to compare, for example with our text compare tool, because the same keys end up on the same lines.
How big a JSON file can it handle?
Files of several megabytes format in well under a second on a normal laptop, because it uses the browser's own JSON engine. Very large files (50 MB and more) depend on your device's memory.
How do I pretty-print JSON in PHP?
Use json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE). To check whether a string is valid JSON in PHP 8.3, call json_validate($string); in older versions decode it and check json_last_error().
More JSON and XML tools
All of them run in your browser, need no sign-up and work on large files. Bookmark the one you use most.
PHP hosting for developers, from ₹99 a month
Pick the PHP version per domain up to PHP 8.3, with MySQL, phpMyAdmin, cron jobs and free SSL in DirectAdmin, on SSD servers. Host Laravel, CodeIgniter or plain PHP APIs. Renews at the same price.
Also on HostKarle: hosting checker · WHOIS lookup · bulk domain search · shared hosting plans