You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// To parse the JSON, add this file to your project and do:
//
// let certificate = try? JSONDecoder().decode(Certificate.self, from: jsonData)
import Foundation
structCertificate:Codable{letexpires:Intletmodules:[Module]letsignature:Stringletversion:IntenumCodingKeys:String,CodingKey{case expires ="expires"case modules ="modules"case signature ="signature"case version ="version"}}structModule:Codable{letname:Stringletswitches:[Switch]enumCodingKeys:String,CodingKey{case name ="name"case switches ="switches"}}structSwitch:Codable{letkey:Stringlettype:StringlettypeInfo:String?letvalue:StringenumCodingKeys:String,CodingKey{case key ="key"case type ="type"case typeInfo ="type_info"case value ="value"}}
The text was updated successfully, but these errors were encountered:
I know this isn't what you're asking for, but FYI, we now support TypeScript input for more control over generated types. Given the file certificate.ts:
I have the below JSON and using this command:
$ quicktype --alphabetize-properties --density normal --no-initializers --src example.json --lang swift --top-level "Certificate" -o out.swift
I don't not get
enum
s forSwitch
.type
(see output below).Input
Output
The text was updated successfully, but these errors were encountered: