This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum JSON: Decodable { | |
case bool(Bool) | |
case double(Double) | |
case string(String) | |
indirect case array([JSON]) | |
indirect case dictionary([String: JSON]) | |
init(from decoder: Decoder) throws { | |
if let container = try? decoder.container(keyedBy: JSONCodingKeys.self) { | |
self = JSON(from: container) |