I have a server that returns a String of this format:
{"success":true,
"visible":false,
"data":
{"ref":"asfdasfsadfaeweatsagsdfsad",
"userRef":"asdfsadfsa","accountType":"REAL",balance":43},
"code":"2200",
"msg":null,
"msgRef":null,
"successAndNotNull":true,
"failedOrNull":false,
"failed":false,
"failedAndNull":false}`
Then I extract the data
by doing this:
val jsonObj : Any! = JSONObject(serverResponse.toString()).get("data").toString()
and I end up with this String:
"{"ref":"safdasfdwaer",
"userRef":"fdgsgdsgdsfg",
"accountType":"REAL",
"balance":43}"
Is there an efficient way to extract the the values into a HashMap with key what is on the left of ":" and value what is on the right of ":"?
I have already seen the answer here (Convert String to Map) but I am not allowed to to use regex