// first convert the string to a list collection
List<Object> list =JSON.parseArray(bxInsertOrderVo.getTourist());
//Then loop through the list collection and convert it to a map collection (you can put the converted value into the new collection. When there are multiple maps in the list collection, you should create a new collection in the loop to avoid key duplication and overwriting)
List< Map<String,Object>> listw = new ArrayList<>();
for (Object object : list){ Map<String,Object> ageMap = new HashMap<>(); Map <String,Object> ret = ( Map<String, Object>) object;//Take the value in the list and turn it into a map ageMap.put( ret.get("phone").toString(), MyUtils.typeJudge(ret.get("birth").toString (),bxInsertOrderVo.getType())); listw.add(ageMap); //Add to list collection to become list<map<String,Object>> collection }
You can also use this
JSON.parseObject(jsonstr, new TypeReference<List<Map<String, Object>>>() {});
Among them, jsonstr refers to the json string of list type: for example: [{"name":"xxx","age":12},{"name":"zzz","age":15}]