if (choices == null) {
return null;
}
JSONArray result = new JSONArray();
for (Choice<?> choice : choices) {
JSONObject jsonChoice = new JSONObject();
jsonChoice.put(JSON_PROPERTY_TYPE_CHOICE_DISPLAYNAME, choice.getDisplayName());
if (cardinality == Cardinality.SINGLE) {
if (!choice.getValue().isEmpty()) {
jsonChoice.put(JSON_PROPERTY_TYPE_CHOICE_VALUE,
getJSONValue(choice.getValue().get(0), dateTimeFormat));
}
} else {
JSONArray values = new JSONArray();
for (Object value : choice.getValue()) {
values.add(getJSONValue(value, dateTimeFormat));
}
jsonChoice.put(JSON_PROPERTY_TYPE_CHOICE_VALUE, values);
}
if (isNotEmpty(choice.getChoice())) {