enum toJSONValue() was expecting that the first argument is the value to be converted. DbObjectType.toJSONValue() is expecting the this value to be the object converted to the json.

Enum.toJSONValue() also need to handle nulls and arrays.

So now Enum.toJSONValue() determines if if the first argument is to be converted or if the this value is the correct value to be converted