diff --git a/src/CloudNative.CloudEvents.NewtonsoftJson/JsonEventFormatter.cs b/src/CloudNative.CloudEvents.NewtonsoftJson/JsonEventFormatter.cs
index 476c3a2..f14896b 100644
--- a/src/CloudNative.CloudEvents.NewtonsoftJson/JsonEventFormatter.cs
+++ b/src/CloudNative.CloudEvents.NewtonsoftJson/JsonEventFormatter.cs
@@ -364,7 +364,7 @@ protected virtual void DecodeStructuredModeDataBase64Property(JToken dataBase64T
/// The data to populate in the property.
protected virtual void DecodeStructuredModeDataProperty(JToken dataToken, CloudEvent cloudEvent)
{
- if (IsJsonMediaType(cloudEvent.DataContentType!))
+ if (IsJsonMediaType(new ContentType(cloudEvent.DataContentType!).MediaType))
{
cloudEvent.Data = dataToken;
}
diff --git a/src/CloudNative.CloudEvents.SystemTextJson/JsonEventFormatter.cs b/src/CloudNative.CloudEvents.SystemTextJson/JsonEventFormatter.cs
index 3aad7ed..2f461f8 100644
--- a/src/CloudNative.CloudEvents.SystemTextJson/JsonEventFormatter.cs
+++ b/src/CloudNative.CloudEvents.SystemTextJson/JsonEventFormatter.cs
@@ -377,7 +377,7 @@ protected virtual void DecodeStructuredModeDataBase64Property(JsonElement dataBa
/// The data to populate in the property.
protected virtual void DecodeStructuredModeDataProperty(JsonElement dataElement, CloudEvent cloudEvent)
{
- if (IsJsonMediaType(cloudEvent.DataContentType!))
+ if (IsJsonMediaType(new ContentType(cloudEvent.DataContentType!).MediaType))
{
cloudEvent.Data = dataElement.Clone();
}
diff --git a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/JsonEventFormatterTest.cs b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/JsonEventFormatterTest.cs
index 1901a90..b9c3412 100644
--- a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/JsonEventFormatterTest.cs
+++ b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/JsonEventFormatterTest.cs
@@ -767,6 +767,7 @@ public void DecodeStructuredModeMessage_NonJsonContentType_JsonStringToken(strin
[Theory]
[InlineData(null)]
[InlineData("application/json")]
+ [InlineData("application/json; charset=utf-8")]
public void DecodeStructuredModeMessage_JsonContentType_JsonStringToken(string contentType)
{
var obj = CreateMinimalValidJObject();
@@ -785,6 +786,7 @@ public void DecodeStructuredModeMessage_JsonContentType_JsonStringToken(string c
[InlineData(null)]
[InlineData("application/json")]
[InlineData("application/xyz+json")]
+ [InlineData("application/xyz+json; charset=utf-8")]
public void DecodeStructuredModeMessage_JsonContentType_NonStringValue(string contentType)
{
var obj = CreateMinimalValidJObject();
diff --git a/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/JsonEventFormatterTest.cs b/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/JsonEventFormatterTest.cs
index b417ead..3fa9a52 100644
--- a/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/JsonEventFormatterTest.cs
+++ b/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/JsonEventFormatterTest.cs
@@ -787,6 +787,7 @@ public void DecodeStructuredModeMessage_NonJsonContentType_JsonStringToken(strin
[Theory]
[InlineData(null)]
[InlineData("application/json")]
+ [InlineData("application/json; charset=utf-8")]
public void DecodeStructuredModeMessage_JsonContentType_JsonStringToken(string contentType)
{
var obj = CreateMinimalValidJObject();
@@ -805,6 +806,7 @@ public void DecodeStructuredModeMessage_JsonContentType_JsonStringToken(string c
[InlineData(null)]
[InlineData("application/json")]
[InlineData("application/xyz+json")]
+ [InlineData("application/xyz+json; charset=utf-8")]
public void DecodeStructuredModeMessage_JsonContentType_NonStringValue(string contentType)
{
var obj = CreateMinimalValidJObject();