πŸ”
Dev Tools

JSON to PHP Array Converter β€” Free Online

Convert JSON data to PHP array syntax online for free. Generate PHP array() or short [] syntax from any JSON object or array. Instant result.

πŸ”’ Runs in your browser β€” files never leave your device
πŸ“‹ JSON Input

About JSON to PHP Array

Converting JSON to PHP array syntax saves time when hardcoding data structures in PHP scripts, creating fixtures for PHP unit tests, or migrating JSON configuration data to PHP config files. Our converter transforms any valid JSON into PHP array syntax, supporting both the legacy array() function syntax and the modern short [] bracket syntax. Nested objects become nested associative arrays, JSON arrays become indexed PHP arrays, and all PHP data types are correctly represented.

🐘
Type
Browser-based β€” instant, no server
πŸ’°
Price
Free forever, no account needed
πŸ“‹
Category
Dev Tools

Frequently Asked Questions

What PHP array syntax is used?

Choose between modern short syntax [] (PHP 5.4+) or legacy array() syntax for compatibility.

Are nested JSON objects converted correctly?

Yes β€” nested JSON objects become nested associative arrays, and JSON arrays become indexed PHP arrays.

What happens to JSON null values?

JSON null becomes PHP null. JSON true/false become PHP true/false.

Does it add var_export formatting?

The output is a valid PHP array literal suitable for direct assignment: $data = [...];

Can I also convert PHP arrays back to JSON?

Yes β€” use our PHP to JSON tool for the reverse conversion.