diff --git a/CHANGELOG.md b/CHANGELOG.md
index affef7c..8fdba87 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -63,7 +63,7 @@ Improvements
### MLEM.Data
Improvements
- **Moved extension methods into matching namespaces to avoid unexpected suggestions**
-- Allow static json converters to throw an exception if a key does not exist
+- Allow static json converters to write null values and to throw an exception if a key does not exist
Removals
- **Removed obsolete types DynamicEnumConverter, CopyExtensions, DynamicEnum, NetBufferSerializer, and NetExtensions**
diff --git a/MLEM.Data/Json/StaticJsonConverter.cs b/MLEM.Data/Json/StaticJsonConverter.cs
index 851328f..3d13dbd 100644
--- a/MLEM.Data/Json/StaticJsonConverter.cs
+++ b/MLEM.Data/Json/StaticJsonConverter.cs
@@ -58,8 +58,12 @@ namespace MLEM.Data.Json {
/// The value.
/// The calling serializer.
public override void WriteJson(JsonWriter writer, T value, JsonSerializer serializer) {
+ if (value == null) {
+ writer.WriteNull();
+ return;
+ }
if (!this.inverse.TryGetValue(value, out var key))
- throw new InvalidOperationException($"Cannot write {value} that is not a registered entry");
+ throw new KeyNotFoundException($"Cannot write {value} that is not a registered entry");
writer.WriteValue(key);
}