When we are integrating with a new REST API, mostly the request and response objects are defined using JSON and we need to convert them to our programming language models. Depending on the complexity of the communication it can be a huge job, just to type them and it is really easy to make typos.
There are plenty of tools on the internet to solve this problem, but I want to highlight one of my favourites: quicktype.
Quicktype supports many language outputs, including but not only:
– C#
– Kotlin
– Javascript
– Java
– Python
– Ruby
– etc
It’s online tool is totally enough for converting few models:
But their command line tool is quite powerful to handle multiple JSON files:
npm install -g quicktype
echo '[1, 2, 3.14]' | quicktype --lang go
Furthermore the tool’s code is available on Github. Sadly, as I can see, it is not heavily maintained anymore.
Disclaimer: this wasn’t a paid promotion, I don’t even know the developers, just like their product.