Add MaxDepth to JsonWriterOptions #44947
Labels
api-approved
API was approved in API review, it can be implemented
api-suggestion
Early API idea and discussion, it is NOT ready for implementation
area-System.Text.Json
Cost:S
Work that requires one engineer up to 1 week
Team:Libraries
User Story
A single user-facing feature. Can be grouped under an epic.
Milestone
Background and Motivation
Whereas
JsonReaderOptions
hasMaxDepth
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 aMaxDepth
property, but is not respected onSerialize
, as there is no way to pass it on to theJsonWriter
.Proposed API
Add a
JsonWriterOptions.MaxDepth
property; set that property when called fromJsonSerializer
.Alternative Designs
The current API, where this is a constant. This decision is described in #27938 , but I couldn't see a rationale.
The text was updated successfully, but these errors were encountered: