Skip to content
OnlineToolStudio

PHP json_decode

runs in your browserno sign-upfree

Decode JSON like PHP json_decode() and see the result as var_dump(), print_r(), var_export() or a PHP array — as associative arrays or stdClass objects.

PHPvar_dump(json_decode($json, true));

Decoded with objects as arrays

JSON198 chars
var_dump()

About this tool

This tool decodes JSON the way PHP’s json_decode() does and shows the result as var_dump(), print_r() or var_export() output — or as a tidy PHP array. Choose associative arrays (json_decode($json, true)) or stdClass objects (json_decode($json)), and see exactly which types PHP gets: 2.0 stays float(2), big numbers become floats, and string lengths are counted in bytes.

How to use

  1. Paste your JSON.
  2. Choose objects as associative arrays or as stdClass objects.
  3. Pick how to show it: var_dump(), print_r(), var_export() or a PHP array.

FAQ

What is the difference between json_decode($json) and json_decode($json, true)?

Without the second argument, JSON objects become stdClass objects ($data->name). With true, they become associative arrays ($data['name']). JSON lists are always arrays.

Why does var_dump show float(2) for 2.0?

In JSON, a number with a decimal point or exponent is a float in PHP, even when it is a whole number. Integers too large for PHP (above 9,223,372,036,854,775,807) also become floats.

Is the output exactly what PHP prints?

Yes — var_dump(), print_r() and var_export() follow PHP 8’s formatting and were checked against real PHP output. Only object numbers like #1 can differ, because they depend on what else your script has created.

How do I go the other way?

Use PHP json_encode to turn a PHP array — or print_r/var_dump output — back into JSON.

Related tools

All tools