Home/Tools/PHP JSON Formatter Online

PHP Tools

PHP JSON Formatter Online

Format and validate JSON used with PHP json_decode and json_encode directly in your browser.

Formatted JSON

{
  "name": "Ada",
  "active": true,
  "roles": [
    "admin",
    "editor"
  ]
}

Use this JSON formatter when debugging payloads that will be passed to PHP json_decode() or returned through json_encode().

Common use cases

  • Pretty-print compact API payloads.
  • Check whether a copied JSON value is valid.
  • Inspect arrays and objects before using them in PHP.

PHP example

$data = json_decode($json, true);

if (json_last_error() !== JSON_ERROR_NONE) {
    throw new RuntimeException(json_last_error_msg());
}

Common mistakes

Single quoted keys, trailing commas, and comments are not valid JSON. PHP expects strict JSON syntax.

FAQ

Does this tool run PHP json_decode?

No. It validates and formats JSON in the browser, which is useful before passing JSON to PHP json_decode.

Is my JSON uploaded?

No. The formatter runs in your browser for the first static version of BuzzPHP.

Related tools

Related guides