Avatar
@swift-5.2.5 import Foundation struct Test: Codable { let a = 5 } struct Test2: Codable { var a = 5 } let json = """ { "a": 10 } """.data(using: .utf8)! let test = try JSONDecoder().decode(Test.self, from: json) let test2 = try JSONDecoder().decode(Test2.self, from: json) print(test.a) print(test2.a)