I am getting JSON response from the API call. But in that response one of the JSONArray is coming as JSONObject if there is no data as given below. Without data : "InbuildData": null.
With data :"InbuildData": [{"value": "Yes","checkStatus":0}]
. Anyone please suggest better option to identify this situation!
Asked
Active
Viewed 29 times
0

Malhotra
- 221
- 3
- 13
1 Answers
0
Not user about your confusion this is a simple case you can handle this like this in your model
@SerializedName("InbuildDataItem")
var inBuildDataItem:InbuildDataItem?=null
data class InbuildDataItem(
@SerializedName("checkStatus")
val checkStatus: Int,
@SerializedName("value")
val value: String
)
Before using check if inBuildDataItem is null or not

Hamid Raza Goraya
- 139
- 5