1

Closed

problem with WriteRaw inside of Collections

description

If I write a converter for a custom object

i.e.
class MyObjectConverter : JsonConverter
{
            private static Type dataType = typeof(MyObject);

            public override bool CanConvert(Type objectType)
            {
                return objectType == dataType;
            }

            public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
            {
                var d = value as MyObject;
                
                writer.WriteRaw("{}");
            }
}
Everything is fine unless I have a collection of MyObject
If I have a collection the serialization appears as
[{} {}] // note without the comma.

I am going to look into why this is occuring, but still working my way through the code and wondering if someone else has seen this issue.
Closed Mar 7, 2013 at 10:24 PM by JamesNK
Use StackOverflow please

comments