How to generate Typescript or C# types from JSON

lucis profile image Lucis ・1 min read

Quick tip today: Frequently I build Node apps for working with pre-defined data (JSON, API's responses) and, after a loving/hating relation with Typescript and deciding that Typescript is good, I enjoy defining my types early on development, since it saves me a lot of time.

For helping me with this, I've found this awesome app that I can just drop a JSON sample and it will generate the types for me, supporting a dozen of languages: Quicktype.

It also has a VSCode Extension that allows you to do this without leaving your editor.

It supports TypeScript, Python, Go, Ruby, C#, Java, Swift, Rust, Kotlin, C++, Flow, Objective-C, JavaScript, Elm, and JSON Schema.

Hope that it helps ;D


Editor guide