JSON to TypeScript
Turn one JSON example into readable, multi-interface TypeScript types.
Convert JSON into a paste-ready PHP array literal, with short or long syntax and a variable or define() wrapper.
No. This produces a single PHP statement (an assignment or a define() call) meant to be pasted into existing PHP code, not a standalone file - add your own opening tag if you save it as its own .php file.
No, and this is a JavaScript limitation, not a choice: JSON.parse collapses 1.0 and 1 to the identical JS number 1 before this tool ever sees it, so both render as the PHP int 1. If you need a literal float, write a fractional value like 1.5, or add a decimal place PHP will keep, e.g. 1.1.
They lose precision. JSON numbers are parsed with JSON.parse into ordinary JavaScript doubles, which cannot represent every integer exactly past Number.MAX_SAFE_INTEGER (9,007,199,254,740,991) - this is the same limitation every JSON tool in this toolbox that uses JSON.parse has. Keep huge IDs as JSON strings if you need them exact.
No - it is PHP's own reserved-word rule. The tool uppercases your name to build the constant, so the default "array" becomes the constant ARRAY, and `array` is a reserved keyword in PHP regardless of case, so a bare ARRAY token elsewhere in your code will not resolve to it. define('ARRAY', ...) itself is perfectly valid and the constant is set; fetch it with constant('ARRAY') instead of the bare word, or pick a different variable name before switching to Constant wrap.
Turn one JSON example into readable, multi-interface TypeScript types.
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.