so, to represent error responses with a format lik...
# android
k
so, to represent error responses with a format like this:
Copy code
{
  "errors": {
    "first_name": [
      "first name is required"
    ],
    "last_name": [
      "last name is required"
    ],
    "image": [
      "Invalid image format"
    ]
  },
  "message": "Invalid profile data",
  "status": 400
}
I parse my json into this response model:
Copy code
data class ErrorResponse (
        var errors: Map<String, List<String>> = emptyMap(),
        var status: Int = 0) {
    operator fun get(k: String): List<String>? = errors[k]
}
😂 1
s
you must keep address of ws developer in case something goes wrong.