Back to Tools
PHP Array to JSON
PHP Array to JSON
Convert PHP associative or indexed arrays into JSON objects
PHP Tool
JSON Result
About the PHP Array to JSON
Convert a PHP array into JSON.
How to use the PHP Array to JSON
- Paste your code into the input box, or click Load Sample to load an example.
- Press Convert to JSON.
- Use Copy (or Download where shown) to keep the result. Clear empties the box.
Worked example
['status' => 'success', 'data' => [1, 2, 3]] becomes {"status":"success","data":[1,2,3]}.
Tips
- In PHP itself, use json_encode() to do this in code.
Frequently Asked Questions
It converts a PHP value into a JSON string.