quicktype / quicktype-vscode

VS Code extension to convert JSON to TypeScript, C#, Go, and many more

Home Page:https://marketplace.visualstudio.com/items?itemName=quicktype.quicktype

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Marketplace Installs Ratings

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

  • Interactively generate types and (de-)serialization code from JSON, JSON Schema, and TypeScript
  • Paste JSON/JSON Schema/TypeScript as code

quicktype infers types from sample JSON data, then outputs strongly typed models and serializers for working with that data in your desired programming language. For more explanation, read A first look at quicktype.

In any JSON file, use the command "Open quicktype for JSON" to summon quicktype, which will generate types from the JSON. Invoke "Change quicktype's target language" to pick a different language. There are similar "Open quicktype" commands for JSON Schema and TypeScript.

Another way to use quicktype is to copy JSON into the clipboard and invoke "Paste JSON as code/types":

For a more powerful experience, including custom options and the ability to generate code from multiple JSON samples, try quicktype.io.

Installing

This extension is available for free in the Visual Studio Code Marketplace

Customization

  • quicktype.justTypes: Generate only types, or also produce (de)serialization code when using "Open quicktype". When using "Paste", you can pick between the commands for "types" and "code", without having to set this option.

  • quicktype.inferMaps, quicktype.inferEnums, quicktype.inferDateTimes, quicktype.inferUuids, quicktype.inferBoolStrings, quicktype.inferIntegerStrings: Tell quicktype whether it should try to infer those types from the input JSON. This is not a precise science, so sometimes the guess will be wrong, which is why you can turn them off through these options. Also, quicktype doesn't support dates, UUIDs and stringified integers/booleans in all target languages yet.

Contribute!

quicktype is an open source project, and we're always happy about contributors. If you can think of a way to improve this extension, or quicktype, please consider contributing, especially if you know TypeScript. Code is only one way to contribute, though: we're particularly short on documentation. We'd also love to hear your feedback - come talk to us on Slack!

If you find a bug, please report it on GitHub.

About

VS Code extension to convert JSON to TypeScript, C#, Go, and many more

https://marketplace.visualstudio.com/items?itemName=quicktype.quicktype

License:Apache License 2.0


Languages

Language:TypeScript 87.7%Language:Shell 11.3%Language:Swift 1.0%