JSON to PHP Array Converter

Convert JSON to a PHP return file with exact 64-bit integer literals, safe string quoting and optional object preservation.

Export PHP data without running it

Paste JSON and download a PHP file that returns its value. Strings use single quotes, escape backslashes and quotes, and represent control characters with chr(). Dollar signs remain literal text. No input is evaluated as PHP or JavaScript.

Associative-array mode converts JSON objects and arrays to PHP arrays; an empty object becomes []. Numeric-looking object keys follow PHP array-key coercion. Choose stdClass mode to preserve the distinction between objects and arrays, including empty objects and numeric property names.

Precision and runtime

Integer literals must fit signed 64-bit PHP integers. Use a 64-bit PHP runtime; 32-bit PHP has a smaller integer range. Decimal literals use PHP floating-point arithmetic and may round. The tool rejects overflow, underflow, duplicate JSON keys, more than 200,000 input characters or 64 levels. JSON data is stored as data, not executable statements.

Questions & answers

Can empty objects survive conversion?

Yes. Select stdClass objects to emit (object) [] instead of an empty associative array.

Will $name or PHP tags in a JSON string execute?

No. They are encoded inside a quoted PHP string. The tool never executes generated PHP. Review the data and include the downloaded file only in your own trusted application.

Other Languages