Add valid JSON
Paste JSON into the editor or open a local .json file containing an object, array, string, number, boolean, or null.
Transform valid JSON into clean, executable PHP array syntax. Preserve nested objects, indexed arrays, Unicode strings, numbers, booleans, and null values without uploading your data.
Create formatted PHP data in three straightforward steps.
Paste JSON into the editor or open a local .json file containing an object, array, string, number, boolean, or null.
Select modern square brackets or classic array() syntax and enter a safe variable name for the generated assignment.
Review the formatted array, copy it into your project, or download a complete executable .php file.
The converter preserves JSON structure and values while producing readable, project-ready PHP.
JSON objects become associative arrays while JSON lists remain zero-indexed PHP arrays.
International text, emoji, apostrophes, backslashes, and control characters are escaped correctly.
Use concise [] syntax for modern PHP or generate compatible classic array() notation.
Parsing, formatting, copying, and downloading all happen inside your browser.
JSON objects become associative arrays with string keys. JSON arrays become indexed arrays. Strings remain quoted strings, numbers stay numeric, and true, false, and null map directly to PHP.
The generator uses single-quoted PHP strings and safely escapes apostrophes, backslashes, line breaks, tabs, and control characters without damaging Unicode text.
The downloaded file contains the PHP opening tag and a valid variable assignment ending with a semicolon. Review untrusted data before using it in security-sensitive code.
// JSON { "id": 42, "name": "Alex", "roles": ["admin", "editor"] } // PHP $data = [ 'id' => 42, 'name' => 'Alex', 'roles' => ['admin', 'editor'], ];
Practical answers about PHP syntax, values, files, and privacy.
Yes. Objects and arrays are converted recursively while preserving their original hierarchy.
Both create PHP arrays. Square brackets are the modern concise syntax, while array() supports older PHP versions.
Object property names become quoted associative-array keys followed by the PHP double-arrow operator.
Yes. JSON true, false, and null values become matching lowercase PHP literals without quotation marks.
Yes. Unicode remains readable, while characters that could break a PHP string are escaped safely.
Yes. A string, number, boolean, or null can be assigned directly to the selected PHP variable.
No. Conversion happens locally in your browser and your JSON is not submitted to the server.
Yes. It contains an opening PHP tag and a complete variable assignment. Always inspect external data before production use.