quicktype将 JSON 和 GraphQL 数据快速生成模型代码
quicktype 可将 JSON, schema 和 GraphQL 字符快速生成模型和序列化代码,以便以任何编程语言快速安全地处理数据。
quicktype 可以生成 Objective-C, Swift 和 Java 等10几种主流编程语言模型。
使用 quicktype
# Run quicktype without arguments for help and options quicktype # quicktype a simple JSON object in C# echo '{ "name": "David" }' | quicktype -l csharp # quicktype a top-level array and save as Go source echo '[1, 2, 3]' | quicktype -o ints.go # quicktype a sample JSON file in Swift quicktype person.json -o Person.swift # A verbose way to do the same thing quicktype \ --src person.json \ --src-lang json \ --lang swift \ --top-level Person \ --out Person.swift # quicktype a directory of samples as a C++ program # Suppose ./blockchain is a directory with files: # latest-block.json transactions.json marketcap.json quicktype ./blockchain -o blockchain-api.cpp # quicktype a live JSON API as a Java program quicktype https://api.somewhere.com/data -o Data.java
评论