I´m using this simple code to show a JSON text into a webview, but the same code it´s working diferent on each device, the problem it´s the columns order, in Cellphones work well and comes with the JSON field order, in tablets with 4.4.2 Android version it´s parsed ok but the columns come with an aleatory order...
Can anyone give me a help...
JSON:
Can anyone give me a help...
B4X:
Dim parser As JSONParser
parser.Initialize("[{""DESCR_GR_IND"":""xxx"",""COD_PROD"":""10015848"",""DESCR_PROD"":""xxxx 5MG - 13 A 25KG - 03 COMPR"",""201611"":0.0000,""201612"":0.0000,""201701"":0.0000,""201702"":0.0000,""201703"":0.0000,""201704"":0.0000,""201705"":1.0000,""201706"":0.0000,""201708"":0.0000,""201709"":1.0000,""201710"":1.0000},{""DESCR_GR_IND"":""xxxx"",""COD_PROD"":""10015849"",""DESCR_PROD"":""xxxx 10MG - 26 A 5KG - 03 COMPR"",""201611"":0.0000,""201612"":0.0000,""201701"":0.0000,""201702"":0.0000,""201703"":1.0000,""201704"":0.0000,""201705"":1.0000,""201706"":0.0000,""201708"":2.0000,""201709"":0.0000,""201710"":1.0000}]")
Dim rows As List
rows = parser.NextArray
Dim mp As Map
Dim m As Map
Colunas.Initialize
m = rows.Get(0)
For z = 0 To m.Size -1
Colunas.Put(z,m.GetKeyAt(z))
Next
JSON:
B4X:
[{"DESCR_GR_IND":"xxx","COD_PROD":"10015848","DESCR_PROD":"xxx 5MG - 1,3 A 2,5KG - 03 COMPR","2016/11":0.0000,"2016/12":0.0000,"2017/01":0.0000,"2017/02":0.0000,"2017/03":0.0000,"2017/04":0.0000,"2017/05":1.0000,"2017/06":0.0000,"2017/08":0.0000,"2017/09":1.0000,"2017/10":1.0000},{"DESCR_GR_IND":"xxx","COD_PROD":"10015849","DESCR_PROD":"xxx 10MG - 2,6 A 5KG - 03 COMPR","2016/11":0.0000,"2016/12":0.0000,"2017/01":0.0000,"2017/02":0.0000,"2017/03":1.0000,"2017/04":0.0000,"2017/05":1.0000,"2017/06":0.0000,"2017/08":2.0000,"2017/09":0.0000,"2017/10":1.0000}]
Last edited: