Skip to content
Devtoolry

JSON to PHP Array

Convert JSON to a PHP array literal using short or long array syntax.

About the JSON to PHP Array

The JSON to PHP Array converter turns JSON into a PHP array literal you can paste into config files, fixtures and tests, using short [] or long array() syntax.

Conversion happens in your browser, so your files and records stay private.

How to use the JSON to PHP Array

  1. Paste JSON.
  2. Choose short [] syntax and whether to wrap the array in <?php return …;.
  3. Copy the PHP code.

Frequently asked questions

How are JSON objects converted?

Objects become associative arrays with string keys; JSON arrays become indexed arrays.

Are special characters escaped?

Yes. Quotes and backslashes in strings are escaped for single-quoted PHP strings.