We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
This is an awesome framework, thank you for making it. I have an XML that looks like this:
<Response> <status>success</status> <Things> <Thing> <ID>123456</ID> </Thing> </Things> </Response>
And a Codable that looks like this:
struct ResponseThing: Codable { let ID: String } struct Response: Codable { let status: String let Things: [ResponseThing] }
throws a missing key error... what am I missing?
The text was updated successfully, but these errors were encountered:
let Things: [ResponseThing] would decode an array of Things not an array of Thing
let Things: [ResponseThing]
Things
Thing
To decode the given XML you would need something like
struct Response: Codable { let status: String let Things: ThingContainer } struct ThingContainer: Codable { let Thing: [ResponseThing] } struct ResponseThing: Codable { let ID: String }
You might also want to take a look at CodingKeys, they will make your code much more readable.
CodingKeys
Sorry, something went wrong.
As soon as I read that I got it, thank you!!!
No branches or pull requests
Hi,
This is an awesome framework, thank you for making it. I have an XML that looks like this:
And a Codable that looks like this:
throws a missing key error... what am I missing?
The text was updated successfully, but these errors were encountered: