1
0
Fork 0

Merge pull request #198 from cholin-bmc/cholin-anytype

Add support for 'any' type conversion to JSON
master
Bob Carroll 2017-07-02 12:25:19 -07:00 committed by GitHub
commit 3665a2f764
1 changed files with 14 additions and 0 deletions

View File

@ -739,6 +739,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");