This project has moved and is read-only. For the latest updates, please go here.

Json TypeNameHandling.Objects without version

Jul 3, 2010 at 11:33 PM

I am using Json.NET to serialize messages with the setting TypeNameHandling.Objects so that the consuming service can deserialize without knowing the type. This works great but since Json.NET includes the full assembly version some conflicts might occur. Is there a way to inform Json.NET how to describe the $type being serialized? I'd like to turn off versioning so my services can be looser coupled.


Jul 4, 2010 at 2:34 PM
I believe this is exactly what the JsonSerializer "TypeNameAssemblyFormat" property is for, and it seems to default to "System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple", which I balieve is what you are asking for. I have used this without issues, but now that you mention it I do see one problem/inconsistency with the "Simple" handling, and that is for Generics - generic argument types are always included in full because of the use of type.FullName; I am submitting a quick patch to handle this, we'll see whether it makes sense to JamesNK, the coordinator/developer/owner.
Jul 4, 2010 at 6:16 PM


Thanks for your reply. i'll give that a look.

Jul 6, 2010 at 12:06 PM
I haven't tested the changes yet, but JamesNK applied a fix for this this morning! (doesn't like my nasty Regexp patch :) )
Jul 7, 2010 at 1:01 AM

When you solve a problem with a regular expression, now you have two problems :P