I have a simple method using NewtonSoft's JSON serializer and I love it (simple, returns formatted JSON). However I can't seem to get it to properly serialize UTF8 characters (they show up as a question mark i.e. '?') that are found in strings within an object.
The code I'm using is:
string serialized = JsonConvert.SerializeObject(obj, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { });
Since you're serializing to a string and not to a byte array, you're not dealing with any character encodings (like utf-8) at this stage.
You'll have to find out where it's actually converted to/from UTF-8 and fix the problem there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With