Closed KarthikaReddy closed 6 years ago
As ObjectMapper README.md states .
is the default delimeter for mapping of nested objects.
Try disabling this feature by mapping the details
property like this:
details <- map["template.image.details", nested: false]
Thanks, that worked!!
How can I use this in Alamofire Request responseObject(keyPath)? Say If I want to directly get image.width attribute Alamofire.request(url).responseObject(keyPath: "template.image.details.image.width") { } I have tried below code as well but did not work. Alamofire.request(url).responseObject(keyPath: "template.image.details->image.width") { }
@KarthikaReddy this is probably a question for stackoverflow
But given the fact that you have .
in your JSON, I think that this is not possible.
Here is sample JSON [ { "TemplateName": "Test Template", "template.image.details": { "image.width": 1024, "image.height": 1024, }, } ] Here is how my Mapper function looks public func mapping(map: Map) { templateName <- map["TemplateName"] details <- map["template.image.details"] } I am getting details object as nil from the Alamofire Object mapper library. I think it is because my JSON response keys contain a "." ("template.image.details"). How can this be fixed?