JSON to PHP Array Converter
Convert JSON to PHP array syntax instantly — ready to paste into your PHP code.
About JSON to PHP Array Conversion
PHP developers frequently need to convert JSON data into PHP array syntax — whether initializing configuration arrays, seeding test fixtures, hardcoding API mock data, or migrating JSON config files into PHP-based configurations. This tool does that conversion instantly and correctly.
The converter supports both PHP 5.4+ short array syntax (e.g., ['key' => 'value']) and the older array() syntax for compatibility with legacy codebases. JSON objects become associative PHP arrays with string keys, JSON arrays become indexed PHP arrays, and all JSON primitives are mapped to their PHP equivalents: strings with single quotes, numbers as-is, booleans as true/false, and null as null.
Strings are escaped using single quotes with proper backslash handling. The output is properly indented and ready to copy directly into your PHP files. You can also optionally wrap the output in a return statement for use as an include-based configuration file (a common PHP pattern).