You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow specifying IndentCharacter and IndentSize when writing JSON (#95292)
* Add IndentText json option
* Add IndentText for json source generator
* Add tests
* IndentText must be non-nullable
* Improve performance
* Add extra tests
* Cleanup
* Apply suggestions from code review
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
* Fixes following code review
* Fixes following code review #2
* Add tests for invalid characters
* Handle RawIndent length
* Move all to RawIndentation
* Update documentation
* Additional fixes from code review
* Move to the new API
* Extra fixes and enhancements
* Fixes from code review
* Avoid introducing extra fields in JsonWriterOptions
* Fix OOM error
* Use bitwise logic for IndentedOrNotSkipValidation
* Cache indentation options in Utf8JsonWriter
* Add missing test around indentation options
* New fixes from code review
* Update src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.cs
* Add test to check default values of the JsonWriterOptions properties
* Fix comment
---------
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Copy file name to clipboardexpand all lines: src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerConfigureOptions.cs
+1-1
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ public void EnsureConsoleLoggerOptions_ConfigureOptions_SupportsAllProperties()
Copy file name to clipboardexpand all lines: src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerExtensionsTests.cs
[System.ObsoleteAttribute("JsonSerializerOptions.AddContext is obsolete. To register a JsonSerializerContext, use either the TypeInfoResolver or TypeInfoResolverChain properties.",DiagnosticId="SYSLIB0049",UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
[System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute("JsonStringEnumConverter cannot be statically analyzed and requires runtime code generation. Applications should use the generic JsonStringEnumConverter<TEnum> instead.")]
// In the worst case, an ASCII character represented as a single utf-8 byte could expand 6x when escaped.
@@ -110,5 +109,13 @@ internal static partial class JsonConstants
110
109
// The maximum number of parameters a constructor can have where it can be considered
111
110
// for a path on deserialization where we don't box the constructor arguments.
112
111
publicconstintUnboxedParameterCountThreshold=4;
112
+
113
+
// Two space characters is the default indentation.
114
+
publicconstcharDefaultIndentCharacter=' ';
115
+
publicconstcharTabIndentCharacter='\t';
116
+
publicconstintDefaultIndentSize=2;
117
+
publicconstintMinimumIndentSize=0;
118
+
publicconstintMaximumIndentSize=127;// If this value is changed, the impact on the options masking used in the JsonWriterOptions struct must be checked carefully.
0 commit comments