diff --git a/retrofit-jsonapi-converter/src/main/java/com/tanasi/jsonapi/converter/JsonApiRequestConverter.kt b/retrofit-jsonapi-converter/src/main/java/com/tanasi/jsonapi/converter/JsonApiRequestConverter.kt index 444cbda..b631fdb 100644 --- a/retrofit-jsonapi-converter/src/main/java/com/tanasi/jsonapi/converter/JsonApiRequestConverter.kt +++ b/retrofit-jsonapi-converter/src/main/java/com/tanasi/jsonapi/converter/JsonApiRequestConverter.kt @@ -74,7 +74,7 @@ class JsonApiRequestConverter : Converter { when { it.param.hasAnnotation() -> { val annotation = it.param.findAnnotation()!! - attributes.put(annotation.name, propValue) + attributes.put(annotation.name, propValue ?: JSONObject.NULL) } it.param.hasAnnotation() -> { val annotation = it.param.findAnnotation()!! @@ -83,7 +83,7 @@ class JsonApiRequestConverter : Converter { } else -> when { it.prop.isJsonApiAttribute() -> { - attributes.put(it.prop.name, it.prop.call(value)) + attributes.put(it.prop.name, it.prop.call(value) ?: JSONObject.NULL) } it.prop.isJsonApiRelationship() -> { relationships.put(it.prop.name,