JSONWriter writer = new JSONStringer().object();
Iterator<UIComponent> iterator = extendedDataTable.columns();
while (iterator.hasNext()) { // initialize a map of all the columns
UIComponent component = iterator.next();
AbstractColumn column = (AbstractColumn) component;
writer.key(column.getId()).value(getValueFromColumn(column));
}
json = new JSONObject(writer.endObject().toString());
} catch (JSONException e) {
e.printStackTrace();
}