-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Cost:SWork that requires one engineer up to 1 weekWork that requires one engineer up to 1 weekTeam:LibrariesUser StoryA single user-facing feature. Can be grouped under an epic.A single user-facing feature. Can be grouped under an epic.api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedapi-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Text.Json
Milestone
Description
Background and Motivation
Whereas JsonReaderOptions has MaxDepth property, JsonWriterOptions does not, instead taking a constant. While this constant is quite large (1000, compared to the default 64 on reading), there is no easy way to work with larger depths.
Even worse, JsonSerializerOptions has a MaxDepth property, but is not respected on Serialize, as there is no way to pass it on to the JsonWriter.
Proposed API
Add a JsonWriterOptions.MaxDepth property; set that property when called from JsonSerializer.
namespace System.Text.Json
{
public partial struct JsonWriterOptions
{
public bool MaxDepth { get; set; }
}
}Alternative Designs
The current API, where this is a constant. This decision is described in #27938 , but I couldn't see a rationale.
Groxan
Metadata
Metadata
Assignees
Labels
Cost:SWork that requires one engineer up to 1 weekWork that requires one engineer up to 1 weekTeam:LibrariesUser StoryA single user-facing feature. Can be grouped under an epic.A single user-facing feature. Can be grouped under an epic.api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedapi-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Text.Json