JSON to PHP Array Converter
Paste JSON to get a ready-to-paste PHP array literal. Objects become associative arrays, arrays stay indexed, and strings are safely single-quoted.
How to convert JSON to a PHP array
- Paste or type your JSON into the box.
- Choose array() or short [] syntax and an indent width.
- Copy the PHP array and paste it into your code.
Examples
Object with a nested array
{"name":"Ada","tags":["dev","math"]}array(
'name' => 'Ada',
'tags' => array(
'dev',
'math',
),
)Frequently asked questions
Is my JSON uploaded anywhere?
No. The conversion runs entirely in your browser, so your data never leaves your device.
What is the difference between array() and short syntax?
They are equivalent in PHP 5.4 and later. Short syntax uses [ and ] instead of array( and ), which many style guides prefer.
How are JSON objects and arrays mapped?
JSON objects become associative PHP arrays with 'key' => value pairs. JSON arrays become indexed arrays with values only.
How are strings escaped?
Strings use single quotes, and any backslash or single quote inside is escaped, which matches how PHP single-quoted strings work.
How are true, false and null handled?
They map to the lowercase PHP keywords true, false and null. Numbers are emitted exactly as written in the JSON.
Related tools
JSON to Python Dict
Convert JSON to a Python dict online. Paste JSON and get a valid dict and list literal with True, False, None and proper quoting. Runs in your browser.
JSON to CSV
Convert JSON to CSV online. Paste an array of objects and get clean, spreadsheet-ready CSV with the right headers. Runs in your browser.
JSON Formatter
Format, validate and minify JSON online. Pretty-print with custom indentation, sort keys and catch syntax errors. Runs in your browser.
Air Fryer Converter
Convert any conventional oven recipe to air fryer settings. Lower the temperature by 25 F and cut the cook time by about 20 percent automatically.
Baking Pan Converter
Swap one baking pan for another and scale the batter to fit. Compares pan areas for round, square and rectangular pans and gives a batter scale factor.
Binary to Decimal
Convert binary to decimal online. Paste any binary number, with or without spaces, and get the exact base-10 value instantly. Runs in your browser.