I'm using the new Json Serializer included in .Net Core (not Newtonsoft).
I am enconding a phone number in an object with the country code, so I have an object with a string property which holds the number. Example:
public class MyObject {
public string phoneNumber { get; set; }
}
var myObject = new MyObject() {
phoneNumber = "+569123123123"
}
I need to encode this object as a Json, so I do:
var jsonToSend = System.Text.Json.JsonSerializer.Serialize(myObject);
What I get as a result is this:
{
"phoneNumber":"\u002B569123123123"
}
What I need is this:
{
"phoneNumber":"+569123123123"
}
So, I need to find a way to disable the encoding of special characters
BTW I'm assuming this is the Json generated because I'm using the Text Visualizer of Visual Studio to inspect the variable in debugging.
Thanks in advance.