Skip to content

JSON to PHP Converter

Embed

Paste this where you want JSON to PHP Converter on your site. Adjust the height to fit.

<iframe src="https://www.browserutils.dev/embed/json-to-php/" width="100%" height="500" frameborder="0" loading="lazy" title="JSON to PHP Converter"></iframe>
<p style="font-size:12px;margin:4px 0 0"><a href="https://www.browserutils.dev/tools/json-to-php/">JSON to PHP Converter</a> by BrowserUtils</p>

Generate PHP classes from JSON.Runs in this tab.

Next step

About JSON to PHP Converter

Free online JSON to PHP converter. Automatically generate PHP classes with typed properties and constructors from JSON data. It runs in your browser. Nothing is sent to a server.

Questions

How do I generate PHP classes from JSON?
Paste your JSON into the input field and the tool will produce PHP classes with typed public properties and a constructor. Nested objects become separate classes.
Does the converter use modern PHP type hints?
Yes, the generated classes use PHP typed properties (string, int, float, bool, array) and typed constructor parameters, compatible with PHP 7.4 and later.
Is the JSON to PHP converter safe for private API data?
Yes, everything runs in your browser. No JSON content is uploaded to a server, so your data stays on your machine.
Can I use the generated PHP classes with Laravel or Symfony?
Yes, the classes use standard PHP typed properties and constructors that work in any framework. You can extend them with framework-specific features like Laravel casts or Symfony serializer annotations.
How does JSON to PHP handle nested objects?
Each nested JSON object becomes a separate PHP class with its own typed properties. The parent class references the child class by name in its constructor and property types.

More in Code Generators

All 26 code generators