quicktype可将JSON,schema和GraphQL字符快速生成模型和序列化代码,以便以任何编程语言快速安全地处理数据。
quicktype可以生成Objective-C,Swift和Java等10几种主流编程语言模型。
使用 quicktype
# Run quicktype without arguments for help and optionsquicktype# quicktype a simple JSON object in C#echo '{ "name": "David" }' | quicktype -l csharp# quicktype a top-level array and save as Go sourceecho '[1, 2, 3]' | quicktype -o ints.go# quicktype a sample JSON file in Swiftquicktype person.json -o Person.swift# A verbose way to do the same thingquicktype \ --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.jsonquicktype ./blockchain -o blockchain-api.cpp# quicktype a live JSON API as a Java programquicktype https://api.somewhere.com/data -o Data.java
评论