@Test public void convertCollectionsJsonToCsv() throws JSONException, IOException { String jsonData = getCollectionsJsonData(); String result = jsonToCsvConverter.convert(jsonData); assertEquals(getCollectionsCsvData(), result); }
public String convert(String jsonData) throws JSONException { Set<String> columns; JSONArray array = new JSONArray(jsonData); JSONObject fullPropertyMap = extractFullPropertyMap(array); columns = extractColumns(fullPropertyMap); String csvResult = buildColumnsLine(columns); csvResult += buildDataLines(array, fullPropertyMap); return csvResult; }
JsonToCsvConverter { public String convert(String jsonData) throws JSONException { Set<String> columns; JSONArray array = new JSONArray(jsonData); JSONObject fullPropertyMap = extractFullPropertyMap(array); columns = extractColumns(fullPropertyMap); String csvResult = buildColumnsLine(columns); csvResult += buildDataLines(array, fullPropertyMap); return csvResult; } }
JsonToCsvConverter { public String convert(String jsonData) throws JSONException { Set<String> columns; JSONArray array = new JSONArray(jsonData); JSONObject fullPropertyMap = extractFullPropertyMap(array); columns = extractColumns(fullPropertyMap); String csvResult = buildColumnsLine(columns); csvResult += buildDataLines(array, fullPropertyMap); return csvResult; }  }
JsonToCsvConverter { public String convert(String jsonData) throws JSONException { Set<String> columns; JSONArray array = new JSONArray(jsonData); JSONObject fullPropertyMap = extractFullPropertyMap(array); columns = extractColumns(fullPropertyMap); String csvResult = buildColumnsLine(columns); csvResult += buildDataLines(array, fullPropertyMap); return csvResult; }  String convert(String jsonData); }
JsonToCsvConverter { public String convert(String jsonData) throws JSONException { Set<String> columns; JSONArray array = new JSONArray(jsonData); JSONObject fullPropertyMap = extractFullPropertyMap(array); columns = extractColumns(fullPropertyMap); String csvResult = buildColumnsLine(columns); csvResult += buildDataLines(array, fullPropertyMap); return csvResult; }  String convert(String jsonData);  }