Coder Social home page Coder Social logo

doggy8088 / quicktype-vscode-refresh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from glideapps/quicktype-vscode

15.0 2.0 2.0 2.28 MB

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

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

License: Apache License 2.0

TypeScript 88.33% Shell 10.72% Swift 0.95%
vscode-extension quicktype

quicktype-vscode-refresh's Introduction

Marketplace Installs Ratings

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.

quicktype-vscode-refresh's People

Contributors

dependabot[bot] avatar doggy8088 avatar dvdsgl avatar hoonoh avatar itowlson avatar raphaklaus avatar schani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

karosli hank619

quicktype-vscode-refresh's Issues

Error with olang when types are inconsistent

Hello!
I have encountered an issue while trying to parse a json object with inconsistent type.

I have created a minimal repro:
Considering below json:
{ "arr": [ { "value": "test1" },{ "value": "test2" },{ "value": false },{ "value": null } ] }

The plugin creates below structures:
type Test struct {
Arr []Arr json:"arr"
}

type Arr struct {
Value *Value json:"value"
}

type Value struct {
Bool *bool
String *string
}

Which returns an error since json.Unmarshall doesn`t know how to act with such typing.
See Go playground here: https://go.dev/play/p/JXXBsrw6fjh

Why is plugin creating a separate struct with pointer types? Is there something I do not understand about parsing?

Request: C structs

Awesome extension! I have just installed and tested it! It works perfectly! Is there any support planned for C structs? :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.