JSON to PHP Array
Convert JSON into an equivalent PHP array literal, ready to paste directly into PHP code.
Paste JSON below - this tool converts it into an equivalent PHP array literal you can paste directly into your code.
Going the other direction? Use the PHP Array to JSON converter instead.
What Does This Tool Do?
It parses JSON and generates the equivalent PHP array literal using the modern short array syntax (['key' => 'value']), correctly handling nested objects and arrays.
Why Use This Tool?
Useful when you have a JSON API response or config file and want to hardcode the equivalent data directly as a PHP array - for a test fixture, a config file, or a quick script.
How to Use It
- Paste valid JSON.
- Click Convert.
- Copy the generated PHP array code.
Limitations
JSON's data types (string, number, boolean, null, array, object) map directly to PHP equivalents - there's no ambiguity in this direction, unlike JSON-to-typed-language conversions that need to infer types.