-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
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
Map Dictionary #56
Comments
Hey @thienhaole92. This is a |
I am testing with httpbin but my respon body is like this. I want to map headers field into a dictionay |
@thienhaole92 can you please give me the |
@sunshinejr This is my URL to httpbin
Response:
|
Okay. I think the most important thing is the type of a dictionary. The issue is rather with struct Post: Mappable {
let args: [String: String]?
let headers: [String: String]?
let origin: String
let url: String
init(map: Mapper) throws {
args = map.optionalFrom("args")
headers = map.optionalFrom("headers")
try origin = map.from("origin")
try url = map.from("url")
}
} Let me know if it solves your issue 🌞 |
If I switch to |
Yes, but this is one of the few types that As a workaround you could use |
please did you find a solution for this problem ? @thienhaole92 |
How can I map json above to an object model? My object model has a variable type is Dictionary. Please help me
The text was updated successfully, but these errors were encountered: