JSON Tools

JSON to PHP Array/Class

Convert JSON data to PHP class definitions with typed public properties. Support nested class generation, suitable for PHP 7.4+.

jsonphparray数组转换

Input

Class Name:

Output

PHP array will appear here

What is JSON to PHP Array/Class?

JSON to PHP class tool can automatically generate PHP class definitions based on JSON data. Generated classes include typed public properties with type declarations (supporting PHP 7.4+ typed properties), and corresponding nested classes are generated for nested JSON objects. The tool automatically analyzes field types, generating correct type annotations for String, int, float, bool, array, etc. Code follows PHP coding standards and can be directly used in Symfony, Laravel, and other frameworks.

When to Use JSON to PHP Array/Class

Use when creating entity classes in PHP projects, generating Data Transfer Objects (DTOs) from API responses, building Laravel Eloquent model properties, or quickly setting up PHP backend data structures.

How to Use JSON to PHP Array/Class

Paste JSON data into the input area. Enter the root class name (optional, defaults to Root). Click the "Convert" button, and the generated PHP class code will be displayed in the output area, including PHP opening and closing tags.