[MariaDB] list inside list. row has multiple data
SELECT t1.id ,JSON_ARRAYAGG( JSON_OBJECT( 't2_id', t2.id, 't2_title', t2.title ) ) AS t2_json FROM t_test1 t1 LEFT JOIN t_test2 t2 ON t2.test1_id=t1.id GROUP BY t1.id ; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; public class JsonToMapListExample { public static void main(String[] args) throws Exception { String jsonData = "[{\"t2_id\": 1, \"t2_title\": \"t21\"},{\"t2_id\": 2, \"t2_title\": \"t22\"}]"; ObjectMapper objectMapper = new ObjectMapper(); List<Map<String, Object>> dataList = objectMapper.readValue(jsonData, new TypeReference<List<Map<String, Object>>>() {}); // Now you can work with the List<Map<String, Object>> data for (Map<String, Object> map : dataList) { System.out.println("t2_id: