### Question:
MapperUtil { public static List<JSONObject> convert(List<SDKField> fields, List<List<Object>> data) { return data.stream() .map(dataRow -> convertRow(fields, dataRow)) .collect(Collectors.toList()); }  static List<JSONObject> convert(List<SDKField> fields, List<List<Object>> data); static JSONObject convertRow(List<SDKField> fields, List<Object> dataRow);  }### Answer:
@Test public void getJsonObjectTest() { List<SDKField> sdkFields = new ArrayList<SDKField>(); SDKField field01 = new SDKField("a.b.c", "string"); SDKField field02 = new SDKField("a.b.d", "string"); SDKField field05 = new SDKField("a.e.c.d", "string"); SDKField field03 = new SDKField("e.f", "string"); SDKField field04 = new SDKField("e.g", "string"); sdkFields.add(field01); sdkFields.add(field02); sdkFields.add(field05); sdkFields.add(field03); sdkFields.add(field04); List<List<Object>> dataTable = new ArrayList<List<Object>>(); ArrayList<Object> record01 = new ArrayList<Object>(); record01.add("val01"); record01.add("val02"); record01.add("val05"); record01.add("val03"); record01.add("val04"); dataTable.add(record01); List<JSONObject> convertedData = MapperUtil.convert(sdkFields, dataTable); assertNotNull(convertedData); assertEquals(convertedData.size(), 1); assertEquals(convertedData.get(0).keySet().size(), 2); assertTrue(convertedData.get(0).get("a") instanceof JSONObject); assertTrue(convertedData.get(0).get("e") instanceof JSONObject); JSONObject hierarchy1 = (JSONObject) convertedData.get(0).get("a"); JSONObject hierarchy2 = (JSONObject) convertedData.get(0).get("e"); assertEquals(hierarchy1.keySet().size(), 2); assertEquals(hierarchy2.keySet().size(), 2); assertTrue(hierarchy1.get("b") instanceof JSONObject); assertTrue(hierarchy1.get("e") instanceof JSONObject); JSONObject hierarchy1_1 = (JSONObject) hierarchy1.get("b"); JSONObject hierarchy1_2 = (JSONObject) hierarchy1.get("e"); assertEquals(hierarchy1_1.keySet().size(), 2); assertTrue(hierarchy1_1.get("c") instanceof String); assertTrue(hierarchy1_1.get("d") instanceof String); assertEquals(hierarchy1_1.get("c"), "val01"); assertEquals(hierarchy1_1.get("d"), "val02"); assertEquals(hierarchy1_2.keySet().size(), 1); assertTrue(hierarchy2.get("f") instanceof String); assertEquals(hierarchy2.get("f"), "val03"); assertTrue(hierarchy2.get("g") instanceof String); assertEquals(hierarchy2.get("g"), "val04"); }