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
- Paste JSON.
- Choose short [] syntax and whether to wrap the array in <?php return …;.
- 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.
Related tools
JSON to CSV
Convert JSON arrays to CSV with automatic column detection, nested object flattening and custom delimiters.
CSV to JSON
Convert CSV to a JSON array with header detection, type inference and delimiter auto-detection.
JSON to XML
Convert JSON to well-formed XML with a configurable root element and attribute support.
XML to JSON
Convert XML to JSON, preserving attributes and repeated elements as arrays.
JSON to YAML
Convert JSON to clean, human-readable YAML.
YAML to JSON
Convert YAML documents to formatted JSON with syntax validation.