Trying to handle the response from API in Android Studio by using Kotlin. When converting the response of server from string to json the null values are converted as "null". If the value is null I want it as null. How to solve this problem?
Volley portion of the code:
val stringRequest = StringRequest(Request.Method.GET, url,
Response.Listener<String> { response ->
jsonList = JSONArray(response) }
Response of the server:
[
{
"id": 213,
"dummy": null
}
]
Call as Json
jsonList.getJSONObject(0).get("dummy")
Result of call:
As a result the below code will return "null" which is totally useless.
jsonList.getJSONObject(0).get("dummy")?.toSting()
