Quicktype.io - generate JSON serialization code for multiple languages

javascript python go java kotlin November 3, 2021

As found on levelup.gitconnected, a Medium site (which may be paywalled), [quicktype][https://app.quicktype.io] is a site that can generate serialization code for JSON, in many languages, including C#, C++, Go, Haskell, Java, JavaScript (… really?), Kotlin, Objective C, Python, Ruby, Rust, Swift… and more.

The way to use it is simple. Paste in JSON into a text box, select a language and a few options, and you’ll get code to parse that JSON into a language-appropriate model, even in languages like JavaScript (which can handle JSON data innately and well.)

The JSON parsing code looks fairly simple for most cases, but that’s generally what you want. You can control the source generation fairly well, too, with the ability to specify packages and namespaces (depending on what the languages support), and you can also determine if “all properties are optional” - you don’t get field-level control over optional properties.

The main issue with the site is that the creators of quicktype are advertising engineering positions at the bottom of the page, with an overlay - so if your JSON stretches to the end of the input box, you can’t read it. (I couldn’t find a way to turn off the overlay without modifying the CSS for the page with the browser’s dev tools.)

in json javascript python go java kotlin

Reading time: 1 minute.