Closed ahmadabudawod closed 4 years ago
Hey, I'd be able to help if you provide a concrete json example and the data structures you currently use for parsing. This might be helpful as well: encoding and decoding custom types
Thanks @nalexn for your quick response, I have found how I can go to nested items from web-repository to be mapped with data structure at interactors. Below the line code that I have updated in your great sample app.
.sinkToLoadable { weakAppState?[\.userData.items] = $0.map { (**$0.records ?? []**) }}
Great! Feel free to open a new issue if something else pops up
I have one case related to decoding JSON, while I have created a model based on the JSON structure which is dictionary but the data that I need is in nested fields with an array type, not at the root level.
Based on the architecture of your application how I can go directly to nested filed to get array because I got the below error once I am trying to parse the actual JSON retrieved from API.
Error: typeMismatch(Swift.Array, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Array but found a dictionary instead.", underlyingError: nil))