Collection<String> () { List<String> result = new ArrayList<>(); String tail = rows.length > 1 ? "," : ""; for (int row : rows) { var pair = (Pair<?, ?>)content.table.getModel().getValueAt(row, 0); if (pair.second instanceof Color) { result.add("\"" + pair.first.toString() + "\": \"" + ColorUtil.toHtmlColor((Color)pair.second) + "\"" + tail); } else { result.add("\"" + pair.first.toString() + "\": \"" + pair.second + "\"" + tail); } } return result; }