Skip to content
🐘

JSON to PHP Converter

Convert JSON to a PHP associative array literal. Configurable indentation, short array syntax, semicolon. Runs in your browser.

JSON vs PHP arrays

PHP supports two array syntaxes: long (array(...), all PHP versions) and short ([...], PHP 5.4+). JSON objects map to PHP associative arrays with string keys; JSON arrays map to indexed arrays. JSON booleans, numbers, and null map cleanly. PHP also has json_decode(), but having a literal is useful for hardcoded fixtures and seeders.

PHP array syntax

  • Short syntax uses [ ] (PHP 5.4+).
  • Long syntax uses array( ) for older codebases.
  • JSON objects become associative arrays; JSON arrays become indexed arrays.

Privacy

All conversion runs 100% in your browser. No data is sent to any server.