How to generate Typescript or C# types from JSON
Lucis

Lucis @lucis

About: Building

Location:
Rio de Janeiro
Joined:
May 24, 2019

How to generate Typescript or C# types from JSON

Publish Date: Jan 6 '20
7 1

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

Comments 1 total

  • cwtuan
    cwtuanFeb 25, 2024

    Hey Lucis: great post about generating types from JSON! Just wanted to add another awesome tool to the mix: json-5.com/json-to-typescript.

    It's specifically designed for TypeScript and offers some cool features like:

    JSON5 support: Handles both standard JSON and JSON5, which can be handy for modern web development.

Add comment