guys, can you help me solve this? i have a json l...
# klaxon
d
guys, can you help me solve this? i have a json like this
Copy code
{
  "msg": "User signin",
  "user": {
    "id": 1,
    "username": "admin",
    "role": "admin",
    "created_at": "2018-11-21 03:55:27",
    "updated_at": "2018-11-21 03:55:27"
  },
  "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9hcGkvdjEvdXNlci9zaWduaW4iLCJpYXQiOjE1NDQxMTI1ODcsImV4cCI6MTU0NDExNjE4NywibmJmIjoxNTQ0MTEyNTg3LCJqdGkiOiJhOHBLNlFxazhnZnFrVzREIn0.JhOqH3c2bsJKjLxhmJ8P1ecT1A7798Q2DC7BtqdXpSo"
}
and i already do something like this to get
msg
and
token
:
Copy code
//httpRequest to api to get the JSON , just call its as a *response*
val respond = String(response)
val json = Parser().parse(StringBuilder(respond)) as JsonObject
val msg = json.string("msg")
val token = json.string("token")
so how to got the value of
id
,
username
,
role
that was inside
user
? or i do something wrong in here?