📥 PASTE YOUR PHP ARRAY INPUT
💥 Invalid PHP array syntax!
📚 TRY AN EXAMPLE — CLICK TO LOAD! EXAMPLES
Assoc Array
['name' => 'John', 'age' => 30]
↓ {"name":"John","age":30}
Indexed Array
['apple', 'banana', 'orange']
↓ ["apple","banana","orange"]
Nested Array
['user' => ['name' => 'Ali'...]]
↓ {"user":{"name":"Ali",...}}
Mixed Types
[1, 'text', true, null]
↓ [1,"text",true,null]
🧠 HOW THE CONVERSION WORKS EXPLAINER
1

The converter strips PHP scaffolding: <?php tags, variable assignments ($var =), and trailing semicolons.

2

It splits by top-level commas (not inside nested brackets or strings) to isolate each key-value pair or array element.

3

=> separators turn associative arrays into JSON objects. Items without => become JSON array elements.

4

PHP types map to JSON: true/false/null stay the same, PHP strings become JSON strings, PHP numbers become JSON numbers.