I have an odd problem. I use WCF RIA with Entity Framework. I've implemented a generic search functionality, which relies on sending back the resulting entities as byte[]
(enter Json.Net) and I'm able to get around all sorts of limitations of strong typedness of RIA. But when I'm deserializing back in the client, my object is not properly assembled. Now what do I mean by that?
The json, technically a string, converted to byte[]
by me and back on the client, contains the related entity information I need. So let's suppose the entity is called Account and it has a related Person object. The json string , even the deserialized jobject, has this Person object and it's details. However, when I deserialize like JsonConvert.DeserializeObject<Account>(jdata, settings)
- Person is null with no errors.
The settings I'm trying are here:
settings = new JsonSerializerSettings()
{
//CheckAdditionalContent = true,
PreserveReferencesHandling = PreserveReferencesHandling.All,
//ReferenceLoopHandling = ReferenceLoopHandling.Serialize
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore,
ObjectCreationHandling = ObjectCreationHandling.Replace,
TypeNameHandling = TypeNameHandling.Auto
};
Any ideas?