Back to Tools

PHP Array to JSON

PHP Array to JSON

Convert PHP associative or indexed arrays into JSON objects

PHP Tool
PHP Array Code
JSON Result

                

About the PHP Array to JSON

Convert a PHP array into JSON.

How to use the PHP Array to JSON

  1. Paste your code into the input box, or click Load Sample to load an example.
  2. Press Convert to JSON.
  3. 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.
Live Support
We usually reply within minutes

Enter your name to start a conversation with our team.