NewtonSoft JSON Series Editor and UTF8 Support

I have a simple method using the NewtonSoft JSON serializer, and I like it (just returns formatted JSON). However, I cannot get it to correctly serialize UTF8 characters (they appear as a question mark ie '?') Which are in the lines inside the object.

The code I use is:

string serialized = JsonConvert.SerializeObject(obj, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { }); 
+4
source share
1 answer

Since you are serializing a string, not an array of bytes, at this stage you do not have any character encodings (e.g. utf-8).

You will need to find out where it was actually converted to / from UTF-8 and fix the problem.

+8
source

Source: https://habr.com/ru/post/1442541/


All Articles