Skip to main content

first-name keeps the hyphen in the draft

Laravel quotes it. TypeScript and the PHP DTO keep the hyphen. Rename before you ship if your language rejects it.

Updated 1 min readMarkdown
first-name keeps the hyphen in the draft

On the JSON converter, a hyphenated key stays in the TypeScript field and the PHP property. Laravel quotes it and the array syntax remains valid.

{"first-name":"Ada","role":"engineer"}

Laravel: 'first-name' => 'Ada'. TypeScript: first-name: string;. PHP DTO: public string $first-name;. The class name stays DataTransferObject.

Draft, then rename

The converter does not rewrite kebab-case into camelCase. If your language rejects the hyphen, rename the field before the draft ships. Conversion stays in the browser.

Not a trailing-comma failure

{"a":1,} clears every format with a parse error. That is a different path. Fix the JSON in the JSON formatter, then convert again.

Guide: https://kepttools.com/guides/json-to-typescript-php-dto-laravel

No comments yet. Be the first to comment.