You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a JSON compatible value serializer with a Emitter (which has a small bestWidth) the resulting string is no longer JSON compatible because of emitted newlines.
varemitter=newEmitter(someWriter,2,5);varjsonSerializer=newSerializerBuilder().JsonCompatible().BuildValueSerializer();//...jsonSerializer.SerializeValue(emitter,"This is a #single# line string",typeof(string));
The hash character causes a double quoted string to be emitted. But because of the bestWidth of 5 in the emitter the string is writton on multiple lines.
Sample output:
key: "This
is a
#single#
line
string"
As .NET fiddle was not working when writing this I attached a sample code to this message: JsonBug.cs.txt
The text was updated successfully, but these errors were encountered:
hakito
changed the title
JSON incampatible value serialization when Emitter has bestWidth
JSON incompatible value serialization when Emitter has bestWidth
Mar 21, 2019
When using a JSON compatible value serializer with a Emitter (which has a small bestWidth) the resulting string is no longer JSON compatible because of emitted newlines.
The hash character causes a double quoted string to be emitted. But because of the bestWidth of 5 in the emitter the string is writton on multiple lines.
Sample output:
As .NET fiddle was not working when writing this I attached a sample code to this message:
JsonBug.cs.txt
The text was updated successfully, but these errors were encountered: