I got this JSON response for the JSON Base (Let's say this is JSON_A):
{
"result": [
{
"id": 1,
"vendorTitle": "erlangga",
"vendor_id": "178",
"userstat": true
}
],
"stas": [],
"code": 200,
}
And this JSON, I have to put this inside my base JSON, but I get confused because of the format. I don't know where should I put it inside my base JSON. Let's say this is JSON_B.
{
"query": [
[
"vendorTitle",
"consists",
"erlangga"
],
[
"userstat",
"true"
]
]
}
So, I use this to retrieve a list when the user tries to search for vendorName When I use Generate JSON to POJO Class in the Android studio plugin it only gives me this:
data class QueryResponse(
val query: String
)
Is this the correct data class format for this kind of JSON? Where should I put my JSON_B to JSON_A. I'm kinda new to this kind of formatting, please kindly help me, Thank you, I really appreciate it a lot.
The response when using JSON_A :
nombu, britishpublication, erlangga, melayu, arabic
The response when using JSON_A and QueryResponse :
arabic, britishpublication, erlangga, melayu
My current DataClass looks like this :
data class JsonA(
val code: Int,
val result: List<String>,
val userStat: Boolean
)
and JsonA result :
data class JsonA_Item(
val id: Int,
val vendorTitle: String,
val vendor_id: String,
val userstat: Boolean
)
{ "query" : [["vendorTitle","contain","erlangga"],["userstat","true"]] }but when the user doesn't search for the value the response will look like this :{ "query" : [["userstat","true"]] }