JSON Formatter & Validator

Format, validate, and minify JSON instantly.

100% client-side. Your data never leaves your browser.

Status: Ready Lines: 0 Size: 0 B
Formatted JSON will appear here...

In Laravel

Laravel's JSON responses are compact, and by default they escape slashes and non-ASCII characters. A URL comes out as https:\/\/hafiz.dev and café as café. Both are valid JSON. Paste a response here to read it, or pass encoding flags when you want readable output:

return response()->json($data, 200, [], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

To check JSON that a user or another service sends you, use the json validation rule. Outside a request, Str::isJson() gives the same answer.

use Illuminate\Support\Str;

$request->validate([
    'settings' => ['required', 'json'],
]);

Str::isJson('{"theme": "dark"}');   // true
Str::isJson('{"theme": "dark",}');  // false: trailing comma

Laravel 13.x docs: JSON responses, The json rule, Str::isJson()

100%

Client-Side

All processing happens in your browser. Your data never touches our servers.

Free

No Signup

Use unlimited times without creating an account.

Fast

Instant Results

Format and validate JSON instantly with keyboard shortcuts support.

Need something custom built?

I build custom Laravel tools, web apps, and SaaS platforms. If you need something beyond off-the-shelf, let's talk.

Contact

Frequently Asked Questions

Why is my JSON invalid when it looks fine?

JSON is stricter than JavaScript. These are the usual causes:

  • A comma after the last item: {"a": 1,}
  • Single quotes: {'a': 1}. JSON needs double quotes for keys and strings.
  • Keys without quotes: {a: 1}
  • Comments, or the values undefined and NaN

The error message shows the position where parsing stopped. The mistake is usually on that line or just before it.

Can formatting change my data?

In three cases, because the formatter parses your JSON with your browser's JavaScript engine:

  • JavaScript stores every number as a 64-bit float, so integers above 9,007,199,254,740,991 lose precision.
  • When an object has the same key twice, only the last value is kept: {"a": 1, "a": 2} becomes {"a": 2}.
  • Keys that are whole numbers, such as "10" and "2", move to the front of the object in ascending order. Other keys keep their order.