PHP Array to JSON Converter β Free Online
Convert PHP array syntax to JSON format online for free. Paste PHP array code and get valid formatted JSON output instantly. No signup needed.
About PHP Array to JSON
Converting PHP arrays to JSON is useful when moving data from PHP config files to JSON configs, creating test API responses, or debugging PHP data structures by viewing them in JSON format. Our converter parses PHP array literals β including both array() and [] syntax, associative and indexed arrays, and nested structures β and produces valid formatted JSON. String, integer, float, boolean, and null values are correctly typed in the JSON output.
Frequently Asked Questions
Does it support both array() and [] syntax?
Yes β both the legacy array() function and modern short [] bracket syntax are supported.
Are PHP associative arrays converted to JSON objects?
Yes β PHP associative arrays (string keys) become JSON objects. Indexed arrays become JSON arrays.
What happens to PHP-specific values?
PHP true/false/null map directly to JSON true/false/null.
Can it handle deeply nested PHP arrays?
Yes β multi-level nested structures are converted correctly.
Can I also convert JSON back to PHP?
Yes β use our JSON to PHP tool for the reverse conversion.