Remove use of IgnoreNullPropertyValueOnRead and ReaderOptions from JsonSerializerOptions (#9429)

Fixes https://github.com/aspnet/AspNetCore/issues/9406
This commit is contained in:
Pranav K 2019-04-16 16:24:17 -07:00 committed by GitHub
parent 2be80522b2
commit 51028dd129
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 13 deletions

View File

@ -323,19 +323,7 @@ namespace Microsoft.AspNetCore.Mvc
/// Gets the <see cref="JsonSerializerOptions"/> used by <see cref="SystemTextJsonInputFormatter"/> and
/// <see cref="SystemTextJsonOutputFormatter"/>.
/// </summary>
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,
},
};
public JsonSerializerOptions SerializerOptions { get; } = new JsonSerializerOptions();
IEnumerator<ICompatibilitySwitch> IEnumerable<ICompatibilitySwitch>.GetEnumerator() => _switches.GetEnumerator();