From this reponse from URLSession dataTask, how do I transpose the data recieved:
response: {"message":"login successful","data":{"id":15,"username":"Dummy2","password":"1234","email":"Dummy2@gmail.com","createdAt":"2017-12-23T19:52:49.547Z","updatedAt":"2017-12-23T19:52:49.547Z"}}
To this struct using the statement
struct User : Codable{
var id: String
var username: String
var password: String
var email: String
var createdAt: String
var updatedAt: String
}
let user = try decoder.decode(User.self, from: jsonData)
It is of the type data but I need just the one data table, not both and I cannot subscript the received jsonData. I cannot get the right format for the from: parameter Im knew to using REST API and JSON and could really use the help. Thank you