Everything runs on your machine — your file is processed right here in your browser and never uploaded to any server.
Input
JSON
Loading...
Output
PHP array
Loading...

About this tool

PHP developers constantly receive data as JSON — API samples, exported settings, test fixtures — yet inside a PHP codebase the natural shape for that data is a native array. This tool converts any JSON document into PHP array syntax you can drop straight into a config file, a database seeder, or a unit test.

It fits Laravel work particularly well, where files in the config directory simply return arrays: paste a JSON sample of your settings and get a ready-made return value. It is also a quick way to build fixture data for PHPUnit tests without calling json_decode on raw strings at runtime.

How to use

  1. Paste your JSON into the left editor, or click Load File if the data lives in a file on your computer.
  2. The PHP array literal is generated live in the right editor while you type — no submit step needed.
  3. Fix any JSON syntax errors flagged during editing and watch the output correct itself instantly.
  4. Click Copy to insert the array into your PHP source, or Download to save the snippet as a file.

The conversion engine here is plain JavaScript executing in your browser, not a remote service. Your API keys, settings, and sample records are transformed on-device and are never posted, cached, or inspected by any server.

Frequently asked questions

Does the output use short array syntax?

Yes. The generated code uses the modern bracket style rather than the older array() call, matching current PSR-influenced coding standards and every supported PHP version in use today.

Why convert to a PHP array instead of calling json_decode?

A literal array is parsed once when the file is compiled and benefits from opcache, while json_decode does work on every request. Literal arrays are also easier to read in code review and can hold inline comments after conversion.

How are nested objects and lists translated?

JSON objects become associative arrays using the arrow operator between keys and values, and JSON arrays become sequential PHP arrays. Nesting is preserved to any depth with matching indentation.