karosLi / quicktype-vscode-yymodel

VS Code extension to convert JSON to TypeScript, C#, Go, and many more 支持 json 转成 oc-yymodel 和 swift-yymodel 形式

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FAQ

Q: There is already a Paste JSON as Code extension. Why do you publish a Refresh version of the same extension?

A: This extension is originally from Paste JSON as Code extension. It because the original extension is not updating since 9/20/2018, 11:48:28 PM. Many of the already fixed bugs/issues are not released. That's why I published this extension with latest version from the quicktype/quicktype-vscode repo.

Introduction

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 yes.

  • quicktype.pickCsharpTargetLanguage: In the .NET world, there are two popular JSON serialization/de-serialization packages. The previous version of QuickType only support for Newtonsoft.Json (a.k.a. Json.NET). This verion of Paste JSON as Code (Refresh) add support for System.Text.Json package and support DateOnly and TimeOnly type that been added from .NET 6.

Contribute!

quicktype is an open source project, and we're always happy about contributors. Due to the lack of maintainence of the original project, I forked a new one for further developments. 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.

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

插件市场

插件市场 https://marketplace.visualstudio.com/

发布插件教程 https://liiked.github.io/VS-Code-Extension-Doc-ZH

发布插件,需要先注册账号,去获取 Personal Access Tokens https://azure.microsoft.com/zh-cn/products/devops/

About

VS Code extension to convert JSON to TypeScript, C#, Go, and many more 支持 json 转成 oc-yymodel 和 swift-yymodel 形式

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

License:Apache License 2.0


Languages

Language:TypeScript 89.6%Language:Shell 9.6%Language:Swift 0.8%