100% local — your data never leaves your browser

JSON to PHP Class Converter — Free Online Tool

Convert JSON to typed PHP 8 classes with constructor property promotion, in your browser. Free and private: your data never leaves your device.

Instant Private Zero cookies

JSON input

PHP output

Why convert JSON to PHP?

Mapping API payloads to PHP value objects by hand is tedious. Paste a sample JSON document above and get typed PHP 8 classes using constructor property promotion, ready to paste into your project.

How it works

The converter parses your JSON locally and generates one class per object, with declare(strict_types=1) at the top. Property names are camelCased, integers map to int, floats to float, booleans to bool and arrays to array. Enable the readonly option to make every promoted property immutable (PHP 8.1+).

Frequently asked questions

Is my JSON data uploaded to a server?
No. Everything runs entirely in your browser with JavaScript. Nothing is sent over the network, which makes the tool safe for sensitive data.
Which PHP version is targeted?
PHP 8.0+ for constructor property promotion and typed properties. Enable the readonly option for PHP 8.1+ immutable DTOs.
How are arrays and nested objects typed?
Nested objects become their own classes; arrays are typed as array, since PHP has no native generics. Strings, ints, floats and bools use native scalar types.

Related converters