Skip to content
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

How to parse array in object #290

Open
dieunguyenantony opened this issue Oct 22, 2019 · 0 comments
Open

How to parse array in object #290

dieunguyenantony opened this issue Oct 22, 2019 · 0 comments

Comments

@dieunguyenantony
Copy link

Here my response
{ "Time" : "22\/10\/2019 10:40:57", "ListValue" : null, "Message" : "Can not found data!", "Code" : "01" }
and request
Alamofire.request(apiRouter) .debugLog().validate() .responseArray(keyPath: "ListValue") { (response: DataResponse<[T]>) in if let status = response.response?.statusCode { switch(status) { case 200: guard response.result.isSuccess else { let err: BaseResponseError = BaseResponseError.init(NetworkErrorType.HTTP_ERROR, String(-2), "Error") completion(nil, err) return } completion(response.result.value,nil) default: let err: BaseResponseError = BaseResponseError.init(NetworkErrorType.HTTP_ERROR, String(-2), "Error ") completion(nil, err) } } }
when I execute , i get error ObjectMapper failed to serialize response
but { "Time" : "22\/10\/2019 10:40:57", "ListValue" : [], "Message" : "Can not found data!", "Code" : "01" } work fine
my problem is "ListValue" : [] and "ListValue" : null
Please help me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant