Converter Web ToolsConverter WebTools

JSON to PHP Array

Create a JSON to PHP in your browser, free and instantly.

Paste JSON to convert it into a PHP array using the modern short array syntax. Objects become associative arrays, arrays become indexed arrays, and strings are properly escaped. Everything runs in your browser.

About JSON to PHP

This tool converts JSON into a PHP array using the modern short array syntax. Paste JSON and get a ready-to-use PHP array: objects become associative arrays, arrays become indexed arrays, and strings are properly escaped.

How JSON to PHP works

How to use it

  1. Paste your JSON.
  2. Copy the generated PHP array.

How it works

It converts each JSON value to its PHP equivalent — objects to associative arrays with quoted keys, arrays to indexed arrays, booleans to true/false, null to null — using the short [] syntax and proper escaping, nicely indented.

Common uses

  • Convert JSON to a PHP array
  • Embed config data in PHP
  • Turn an API sample into PHP
  • Avoid manual array typing
  • Migrate JSON to PHP code
  • Build fixtures or seeds
  • Learn PHP array syntax
  • Paste data into a PHP file

Frequently asked questions

How do I convert JSON to PHP?
Paste JSON and copy the PHP array it generates.
Which array syntax is used?
The modern short syntax with square brackets.
Are objects associative arrays?
Yes — object keys become associative array keys.
Is my JSON uploaded?
No — it converts in your browser.
Are strings escaped?
Yes — quotes and backslashes are escaped correctly.
Can I use json_decode instead?
Yes, at runtime — this is for pasting data straight into code.
Does it handle nesting?
Yes — nested structures are converted and indented.
Is it free?
Yes — completely free with no sign-up.