JSON → PHP classes
ClientPaste JSON to emit typed properties and list<T> phpdoc for arrays—add hydration with your framework or json_decode as needed.
Learn more: JSON and PHP
Generate PHP 8+ classes with typed properties and `list<…>` phpdoc for arrays—add hydration with your framework or json_decode/json_encode.
Scope
This is structural scaffolding; wire DTOs into your ORM or API client as your project requires. Mixed/null primitives use `mixed` as a placeholder.
JSON → PHP
?
Parses JSON in your browser and emits classes inferred from the sample shape. Nested objects become nested types; arrays use the first element only to guess item shape. Nothing is uploaded.
Typed properties target PHP 8+; add json_decode/json_encodeor your framework's hydrators as needed.
Common use cases
- Outline typed classes for Laravel or Symfony HTTP clients from a JSON sample.
- Document webhook payloads before writing validation rules.
- Compare inferred array shapes with phpdoc list<> templates.
Common mistakes to avoid
Trusting strict_types without validating input
Generated properties are hints; still validate and sanitize at the HTTP boundary.
Mixing associative arrays and objects inconsistently
json_decode depth and object vs array flags change behavior—align with your framework’s conventions.
FAQ
Is PHP generation local?
Yes. Code is produced entirely in your browser.
Does this emit Symfony or Laravel attributes?
It outputs structural classes. Add framework annotations and serializers for your stack.
More tools
Related utilities you can open in another tab—mostly client-side.
JSON → Ruby classes
ClientRuby classes with attr_accessor from sample JSON—snake_case symbols, local only.
JSON → Python TypedDict
ClientTypedDict scaffolding from sample JSON—nested shapes inferred in the browser.
JSON formatter
ClientJSON format online: pretty-print, minify, validate, escape, download .json.
YAML ↔ JSON
ClientYAML to JSON and JSON to YAML online—format, validate, convert locally.