Creative Workflow Helpers

PHP Array / JSON Converter

Paste a PHP array to get clean JSON, or paste JSON to get PHP array syntax. Everything runs in your browser — your data never leaves the page.

Runs in your browser v1.0.0

Direction & options

live
Conversion direction

Input

PHP array

Accepts array( ... ) and [ ... ] syntax, including an optional <?php, return, $var = wrapper and trailing semicolon.

Output

Converted output appears here.

How it works

A small parser reads common PHP array syntax and rebuilds it as JSON. Sequential integer keys starting at 0 become a JSON array; every other key set becomes a JSON object, matching json_encode(). Going the other way, JSON arrays become PHP lists and JSON objects become associative arrays. Invalid input is reported with a line and column instead of a blank screen.