dvlwj
03/12/2019, 9:48 AM{
"records" : [
{
"field": value ,
"field": value
},
{
"field": value,
"field": value
},
// etc until xxx times
}
how i can parse the records
?
I know and already can parse the data inside records
, but i m not sure how to get records
.
I already try to parse it with this code :
class Records(val Records:List<Any>? = null)
but its failed.dvlwj
03/13/2019, 2:03 AMcedric
03/13/2019, 2:31 AMcedric
03/13/2019, 2:32 AMrecords
(lowercase 'r')dvlwj
03/13/2019, 3:15 AM{
"Records" : [
{ blablabla }
}
and well, isn't streaming one just possible if the API not give you all the data in one bundle?
in my case the API send me all the data in one bundle. Damn.dvlwj
03/13/2019, 3:15 AMcedric
03/13/2019, 3:36 AMdvlwj
03/13/2019, 3:51 AMdvlwj
03/13/2019, 3:51 AMRecords
field specifically right? I can ignore everything then? and just use the streaming?dvlwj
03/13/2019, 6:49 AMUnexpected character at position 1: 'j' (ASCII: 106)'
my code is this :
val respondItem = String(response.data) // change the json i got from api to string
val records = Klaxon().parse<Records>(respondItem) //parse it like usual
val recordsString = records?.Records.toString() //change result to string
val item = Klaxon().parse<Item>(recordsString) // parse it again and error occured here
and this is my class data file :
class Records(val Records: List<Item>)
class Item(
val ID: Long,
val Kode: String,
val Kode2: String,
val GrpStkID: Int,
val GroupStk: String,
val GrpSt2ID: Int,
val GroupSt2: String,
val GrpSt3ID: Int,
val GroupSt3: String,
val Nama: String,
val HargaBeli: String,
val HargaJual1: String,
val HargaJual2: String,
val HargaJual3: String,
val HargaJual4: String,
val HargaJual5: String,
val HargaJual1Nilai: Double,
val HargaJual2Nilai: Double,
val HargaJual3Nilai: Double,
val HargaJual4Nilai: Double,
val HargaJual5Nilai: Double,
val HargaJual1Sat: Int,
val HargaJual2Sat: Int,
val HargaJual3Sat: Int,
val HargaJual4Sat: Int,
val HargaJual5Sat: Int,
val Sat_K_01: Float,
val Sat_K_02: Float,
val Sat_K_03: Float,
val Sat_K_04: Float,
val Sat_K_05: Float,
val Sat_K_06: Float,
val Sat_K_07: Float,
val Sat_K_08: Float,
val Sat_K_09: Float,
val Sat_K_10: Float
)
got any idea why?cedric
03/13/2019, 4:32 PMdvlwj
03/14/2019, 2:29 AMdvlwj
03/14/2019, 2:30 AM