JSON to PHP Array Converter
Turn JSON into PHP short array syntax with proper escaping, client-side.
The JSON to PHP Array Converter parses JSON and prints PHP short array syntax with
=> pairs, single-quoted strings, and literal true, false, and
null. Handy when porting API samples into Laravel, WordPress, or plain PHP config.
What this tool does
- Objects become associative arrays with quoted keys.
- Arrays stay ordered lists.
- Strings are escaped for single-quoted PHP literals.
- Runs client-side; your data never leaves the browser.
How to use it
- Paste JSON on the left (or load a
.jsonfile). - Click Convert.
- Copy or download the PHP array and paste into your project (wrap in
$var = ...;as needed).
Limitations
Output is a PHP array expression, not a full .php file. Very large documents may be slow in the
browser; consider chunking for huge payloads.
Frequently Asked Questions
Why single quotes around every string?
Single-quoted strings avoid unexpected variable interpolation and keep escaping predictable for typical PHP config snippets.
Does it support JSON with Unicode or emoji?
Yes. Characters are preserved inside the quoted PHP strings; escape sequences are added only where PHP requires them (backslashes and single quotes).
Can I convert back from PHP to JSON?
This tool is one-way. Use a PHP runtime or another parser if you need to round-trip PHP arrays to JSON.
Tags
Related tools
Your recent visits