quicktype news vol. 4
Our biggest set of updates ever. Let's get right to it!
New Languages
- Objective-C with no dependencies
- Kotlin via Klaxon
- Rust
- Ruby with runtime typechecking
- Flow
- Vanilla JavaScript with runtime typechecking
New C# Features
- Option to fail if required properties are missing from JSON.
- Option to choose
Double
orDecimal
for floating-point numbers. - Option to choose
Object
ordynamic
for properties without type information.
New Swift Features
URLSession
task extensions make it easier than ever to download API data as structs without any dependencies:
let task = URLSession.shared.pokedexTask(with: url) { pokedex, response, error in
if let pokedex = pokedex {
...
}
}
task.resume()
- Alamofire extensions add similar extensions for working with Alamofire.
- Option to specify a type name prefix.
- Option to choose
internal
orpublic
access level for creating library code.
Drag-and-drop Multiple Files
Try dropping multiple JSON files into quicktype to generate a coherent set of types. quicktype will infer equivalent types across the samples to prevent duplicates.
Share quicktype Easily
The new Share Link
button will generate a link to share your input and options:
This is a great way to help another developer generate code with quicktype, or to make a snapshot of quicktype to refer to later.
Download Code as zip
quicktype generates multiple files for languages like Objective-C and Java, so now you can click Download Code
to get a zip containing many source files rather than creating separate files manually.
quicktype Playgrounds
quicktype playgrounds allow you to embed quicktype in any webpage by including a single script and placing some sample JSON in a <div>
. This is great for pages that display JSON because it allows visitors to immediately copy code to represent the data in their apps.
TypeScript Input
For succinct, precise control over generated types, you can now use TypeScript as an input language. Here's an example of an AddressBook
type specified in TypeScript, then generated in every language quicktype supports.
Postman Input
You can quicktype an entire Postman Collection by dropping it into quicktype:
Learn more about this feature on the Postman blog.
Visual Studio and Xcode Extensions
Try our free & open source Visual Studio and Xcode extensions. You can find the repos here and here.
Improvements to quicktype Core Library
Better map inference using Markov chains.
- Support for more JSON Schema features, documentation as comments, better error reporting, better naming, renaming.
Extend a language or implement your own using quicktype as a library
Did you know that quicktype is also a library? In fact, all quicktype apps (web, CLI, IDE extensions, and playgrounds) use the same open-source quicktype
library from npm
.
Use it from JavaScript by doing npm i quicktype
then:
import { quicktype } from "quicktype";
const result = quicktype({ ... });
Here are two examples of using quicktype as a library:
Thank you!
Thank you for using quicktype. We love working on it and helping developers wrangle the world's messy JSON data. If you'd like to support us, please share quicktype by writing blog posts, making screencasts, demoing it at meetups, or just sharing it with friends & colleagues.
As always, please let us know if there are any new features you'd find useful! Say "👋" on Slack if you'd like to get in touch with us, or just click the chat bubble in the lower-right. Thanks!