Monday, 15 September 2014

.net - ServiceStack.Text JsonSerializer cannot deserialize its own serialized schema (Type definitions should start with a '{' SerializationException) -



.net - ServiceStack.Text JsonSerializer cannot deserialize its own serialized schema (Type definitions should start with a '{' SerializationException) -

i using servicestack.text in .net. want serialize instance of:

idictionary<string, resourcespec>

resourcespec is:

public class resourcespec { public string typename { get; set; } public hashset<property> properties { get; set; } }

it serializes format:

{1:{"typename":"channel","properties":[audio,video]},2:{"typename":"channel","properties":[audio,video,encrypted]}}

when seek deserialize with:

jsonserializer.deserializefromstream<idictionary<string, resourcespec>>(file);

i exception:

serializationexception: "type definitions should start '{', expecting serialized type 'resourcespec', got string starting with: properties"

any ideas what's wrong?

your serialized string seems missing double quotes such "1" , "audio", "video", etc. quoted string deserialized fine me using 3.9.71.

.net serialization servicestack jsonserializer servicestack-text

No comments:

Post a Comment