Repository navigation
Use System.Text.Json's copy ctor - #21016
Conversation
|
Is this something we should patch? |
|
The copy ctor and the property being tested are new in 5.0. |
|
I see |
| jsonSerializerOptions = new JsonSerializerOptions(jsonSerializerOptions) | ||
| { | ||
| Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, | ||
| }; |
There was a problem hiding this comment.
Hopefully the new CreateForWeb option uses the right defaults and then we don't need this at all 👀
There was a problem hiding this comment.
@rynowak @pranavkm It seems like you want us to include this in the new JsonSerializerOptions for web. So, the web options will have PropertyNameCaseInsensitive = true, PropertyNamingPolicy = JsonNamingPolicy.CamelCase, and Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping.
Is that correct?
I also pointed this out on dotnet/runtime#34626 (comment) in case you missed it.
cc @layomia
There was a problem hiding this comment.
AFAIK, when I spoke to @GrabYourPitchforks, the recommendation was that using UnsafeRelaxedJsonEscaping is only safe if the JSON wasn't interspersed with markup. Web might not convey that this is meant for REST \ API scenarios.
No description provided.