Paste PHP array code
Enter an array using square brackets or the array() syntax.
Convert PHP indexed, associative and nested arrays into clean JSON. Copy or download your result instantly.
Enter a PHP array expression below
Enter an array using square brackets or the array() syntax.
The tool reads supported PHP array syntax and creates JSON.
Copy the result or save it as a .json file.
A PHP Array to JSON Converter transforms a PHP array expression into JavaScript Object Notation (JSON). Developers use this when sending PHP data to JavaScript, working with REST APIs, preparing configuration data or exchanging information between applications.
This tool supports common array expressions written with square brackets, such as ['name' => 'Alex'], and the older array('name' => 'Alex') syntax. It supports nested arrays, indexed values, associative keys, strings, numbers, booleans and null.
Sequential numeric keys starting at zero become a JSON array. Associative or non-sequential keys become a JSON object. Nested arrays become nested JSON arrays or objects based on their keys.
No. It parses a safe subset of PHP array literal syntax in your browser. It does not evaluate variables, call functions, create objects or execute PHP code. Expressions and unsupported PHP syntax are rejected.
Yes. Convert supported PHP arrays, copy the result and download JSON for free.
Yes. Nested square-bracket arrays and nested array() expressions are supported.
No. Enter one array expression.
This is an array-literal converter, not a PHP interpreter. Variables as values, function calls, class instances, concatenation and arbitrary statements are not evaluated.
No. Parsing and conversion take place in your browser. The input is not submitted to this website by the converter.
Practical utilities and programming tutorials from Tech Area.