JSON to PHP Array
Convert JSON into a paste-ready PHP array literal, with short or long syntax and a variable or define() wrapper.
Turn one JSON example into readable, multi-interface TypeScript types.
This tool infers types from one example document, not a schema. If a field is null in your sample, there is no other value in that document to widen it against, so it comes out as the literal type null - widen it by hand to `string | null` (or whatever the real type is) if you know the field can hold other values.
There are no elements to infer a type from, so it becomes `unknown[]`. This is a documented limitation, not a bug - supply an example with at least one element in the array if you want a real element type.
Each nested object is named from its field name using a light PascalCase-and-singularize heuristic (e.g. "orders" -> Order), not a grammar engine, so unusual plurals may not singularize perfectly. If two different fields would produce the same name for genuinely different shapes, the tool appends a number (Order, Order2, ...) rather than overwriting one; identical shapes at different field names are left as separate interfaces without deduplication, by design.
They are merged into one interface: the field list is the union of every key seen, and any key that is not present in every element is marked optional (regardless of the general "make everything optional" toggle, which is a separate, blanket setting).
Convert JSON into a paste-ready PHP array literal, with short or long syntax and a variable or define() wrapper.
Format, indent and inspect JSON with clear error reporting.
Check whether JSON is valid and see exactly where it breaks.
Your input is saved in this browser so a refresh does not lose it. Tools handling credentials are never saved.