import Foundation struct Foo: Codable { let a = 1 } let encoder = JSONEncoder() print(try String(data: encoder.encode(Foo()), encoding: .utf8))