1
0
Fork 0

Add support for 'any' type conversion to JSON

master
cholin-bmc 2017-03-07 14:38:57 -08:00
parent c9220cb17e
commit c50adc2a3f
1 changed files with 14 additions and 0 deletions

View File

@ -732,6 +732,20 @@ public final class Field {
throw new JiraException("Field '" + name + "' expects a Numeric value");
}
return value;
} else if (m.type.equals("any")) {
if (value == null)
return JSONNull.getInstance();
else if (value instanceof List)
return toJsonMap((List)value);
else if (value instanceof ValueTuple) {
JSONObject json = new JSONObject();
ValueTuple tuple = (ValueTuple)value;
json.put(tuple.type, tuple.value.toString());
return json.toString();
} else if (value instanceof TimeTracking)
return ((TimeTracking) value).toJsonObject();
return value;
}
throw new UnsupportedOperationException(m.type + " is not a supported field type");