Skip to content
LovTools
EN

JSON to PHP Array

Convert JSON into PHP short array syntax.

Processed locally on your device — nothing is uploaded.

About the JSON to PHP Array

Config files, test fixtures and seeders in PHP often need data as arrays rather than JSON strings. Paste JSON and get properly indented PHP short array syntax, with strings in single quotes (apostrophes escaped), true/false/null as PHP literals and nested arrays preserved.

The output starts with <?php and a $data variable, ready to paste.

How to use the JSON to PHP Array

  1. Paste JSON.
  2. Copy the PHP array.
  3. Paste it into your code.

Features

  • Short array syntax
  • Escaped strings
  • Nested arrays
  • Readable indentation

Supported formats

  • Plain text

Frequently asked questions

Why not use json_decode at runtime?

You can — this is for when you want the data written directly in code or config.

Is my text sent anywhere?

No. Everything runs in your browser, so nothing you paste is uploaded or stored.

Added · Last reviewed · Maintained by Sohail Khax · How we test tools