JsonSerializer escaping '&'
I looked at https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/character-encoding and I still got nothing, I don't understand why these few symbols don't work in json format?
How to customize character encoding with System.Text.Json - .NET
Learn how to customize character encoding while serializing to and deserializing from JSON in .NET.
7 Replies
Do I have to do something like
[JsonInclude]
?
Does it matter if it gets deserialized correctly anyway?
JS has no issues parsing the escaped ampersand either
Pretty sure if I tried Python, Dart, Kotlin, Rust, or whatever else is supposed to be consuming that JSON, they would have no issues either
Well I'm making it so the user can open the json and change the values. So when it gets rewritten it ruins the &
Ah
Well, this should work, then: https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/character-encoding#serialize-all-characters