PHP to JSON Converter
Convert PHP arrays and objects into valid JSON with automatic type detection.
PHP Input
JSON Output
How to Use
- Paste PHP array code or upload a .php file.
- Choose formatting options (pretty print, remove nulls).
- Copy or download the JSON output.
Frequently Asked Questions
What PHP syntax is supported?
Both short syntax ([...]) and long syntax (array(...)) are supported, along with $variable = assignments, <?php tags, and comments.
Does it handle nested arrays?
Yes. Nested associative arrays become JSON objects, and indexed arrays become JSON arrays.
How are PHP types mapped to JSON?
Strings become JSON strings, integers and floats become numbers, true/false/TRUE/FALSE become booleans, and null/NULL becomes null.
Is my data secure?
Yes. All parsing runs in your browser. No data is sent to any server.