Skip to content

Commit

Permalink
Handle null values in JSON as empty/default value (#876)
Browse files Browse the repository at this point in the history
* skip null values in JSON
  • Loading branch information
mjacoby authored Sep 4, 2024
1 parent 7758447 commit 65c23dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
package de.fraunhofer.iosb.ilt.faaast.service.dataformat.json;

import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.DeserializationConfig;
Expand Down Expand Up @@ -532,6 +534,7 @@ public com.fasterxml.jackson.databind.JsonDeserializer<?> modifyCollectionDeseri
ReflectionHelper.ENUMS.forEach(x -> module.addDeserializer(x, new EnumDeserializer(x)));
mapper.registerModule(module);
mapper.registerModule(new JavaTimeModule());
mapper.setDefaultSetterInfo(JsonSetter.Value.forValueNulls(Nulls.SKIP));
}

}
1 change: 1 addition & 0 deletions docs/source/other/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
**Internal changes & bugfixes**
- General
- Fixed bug in JSON valueOnly deserialization that could occur with complex strcutures (e.g. SubmodelElementCollections within SubmodelElementLists)
- Fixed bug caused by null values in JSON payload when inserting data via HTTP - null values are now treated as empty/default values

## 1.1.0

Expand Down

0 comments on commit 65c23dd

Please sign in to comment.