Parse Json Swift

I have some json "" but i'm not sure how to have the right structure to parse it. I get the error : NestedObj2 does not conform to protocol decodable

struct Go: Codable {

**let** meta: NestedObj


**struct** NestedObj: Codable {

**let** success: BooleanLiteralType

**let** code: Int

**let** message: String

**let** totalCount: Int

**let** pageCount: Int

**let** currentPage: Int

**let** perPage: Int

**let** rateLimit: NestedObjA

**let** result: [NestedArr]


**struct** NestedObjA: Codable {

**let** limit: Int

**let** remaining: Int

**let** reset: Int


**struct** NestedArr: Codable {

**let** id: String

**let** first_name: String

**let** last_name: String

**let** gender: String

**let** dob: String

**let** email: String

**let** phone: String

**let** website: URL

**let** address: String

**let** status: String

**let** link: NestedObj2


**struct** NestedObj2: Codable {

**let** serm: NestedObj3

**let** edit: NestedObj4

**let** avatar: NestedObj5


**struct** NestedObj3 {

**let** href: URL


**struct** NestedObj4 {

**let** href: URL


**struct** NestedObj5 {

**let** avatar: URL


**enum** CodingKeys: String, CodingKey {

**case** serm = "self"

**case** _meta = "meta"

**case** _links = "link"


For simple JSON I typically just write the type(s) myself, but otherwise I use something like which can generate the type(s) for me from the JSON.

I’m on phone so can’t properly reply, but from a quick look that structure looks quite different from the JSON (also you shouldn’t use BooleanLiteralType, just Bool).

Members of NestedObj2 (NestedObj3, 4 and 5) aren’t conforming to the protocol Codable.

1 Like