Report Tool or Give Us Suggestions

JSON to PHP Array Converter

Turn JSON into PHP short array syntax with proper escaping, client-side.

L ading . . .

The JSON to PHP Array Converter parses JSON and prints PHP short array syntax with => pairs, single-quoted strings, and literal true, false, and null. Handy when porting API samples into Laravel, WordPress, or plain PHP config.

What this tool does

  • Objects become associative arrays with quoted keys.
  • Arrays stay ordered lists.
  • Strings are escaped for single-quoted PHP literals.
  • Runs client-side; your data never leaves the browser.

How to use it

  1. Paste JSON on the left (or load a .json file).
  2. Click Convert.
  3. Copy or download the PHP array and paste into your project (wrap in $var = ...; as needed).

Limitations

Output is a PHP array expression, not a full .php file. Very large documents may be slow in the browser; consider chunking for huge payloads.

Frequently Asked Questions

Why single quotes around every string?

Single-quoted strings avoid unexpected variable interpolation and keep escaping predictable for typical PHP config snippets.

Does it support JSON with Unicode or emoji?

Yes. Characters are preserved inside the quoted PHP strings; escape sequences are added only where PHP requires them (backslashes and single quotes).

Can I convert back from PHP to JSON?

This tool is one-way. Use a PHP runtime or another parser if you need to round-trip PHP arrays to JSON.

Tags

JSON PHP Array Developer Tools Data Conversion
logo OnlineMiniTools

OnlineMiniTools.com is your ultimate destination for a wide range of web-based tools, all available for free.

Feel free to reach out with any suggestions or improvements for any tool at admin@onlineminitools.com. We value your feedback and are continuously striving to enhance the tool's functionality.

© 2026 OnlineMiniTools . All rights reserved.

Hosted on Hostinger

v1.8.7