list<qitafree> qitafreelist = Gsonutils.getgson (). Fromjson (Exhimain.getqitafressjson (), New TypeToken<List <QiTaFree>> () {}.gettype ()); Exhimain.setqitafrees (qitafreelist);//Other if (qitafreelist!=null && qitafreelist.size () >0) {for (Qitafree qitafree:qitafreelist) { if ("1". Equals (Qitafree.getcaltype ())) {//1 represents othercharges = (long) in units (Othercharges + qitafree.getprice ( )); } else if ("2". Equals (Qitafree.getcaltype ())) {//Represents the calculation of the booth area othercharges = othercharges + Math.Round ( Qitafree.getprice () * Zhanarea);}}
This Gsonutils.getgson (). Fromjson (Exhimain.getqitafressjson (), New typetoken<list<qitafree>> () when you turn the generic type into a collection. {}.gettype ());
If such as this turn list<string> fanlist = Gsonutils.getgson (). Fromjson (Exhimain.getfanwei (), arraylist.class); It doesn't work.
The String type is stored in JSON format and can be turned into a generic collection
Gsonutils.getgson (). Fromjson () Turn generic collection