Remove use of IgnoreNullPropertyValueOnRead and ReaderOptions from JsonSerializerOptions (#9429)
Fixes https://github.com/aspnet/AspNetCore/issues/9406
This commit is contained in:
parent
2be80522b2
commit
51028dd129
|
|
@ -323,19 +323,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// Gets the <see cref="JsonSerializerOptions"/> used by <see cref="SystemTextJsonInputFormatter"/> and
|
/// Gets the <see cref="JsonSerializerOptions"/> used by <see cref="SystemTextJsonInputFormatter"/> and
|
||||||
/// <see cref="SystemTextJsonOutputFormatter"/>.
|
/// <see cref="SystemTextJsonOutputFormatter"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JsonSerializerOptions SerializerOptions { get; } = new JsonSerializerOptions
|
public JsonSerializerOptions SerializerOptions { get; } = new JsonSerializerOptions();
|
||||||
{
|
|
||||||
// Allow for the payload to have null values for some inputs (under-binding)
|
|
||||||
IgnoreNullPropertyValueOnRead = true,
|
|
||||||
|
|
||||||
ReaderOptions = new JsonReaderOptions
|
|
||||||
{
|
|
||||||
// Limit the object graph we'll consume to a fixed depth. This prevents stackoverflow exceptions
|
|
||||||
// from deserialization errors that might occur from deeply nested objects.
|
|
||||||
// This value is to be kept in sync with JsonSerializerSettingsProvider.DefaultMaxDepth
|
|
||||||
MaxDepth = DefaultMaxModelBindingRecursionDepth,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
IEnumerator<ICompatibilitySwitch> IEnumerable<ICompatibilitySwitch>.GetEnumerator() => _switches.GetEnumerator();
|
IEnumerator<ICompatibilitySwitch> IEnumerable<ICompatibilitySwitch>.GetEnumerator() => _switches.GetEnumerator();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue