tags:

views:

51

answers:

0

So I was working toward a fairly lightweight approach at serializing some of my objects, and was hoping to use NewtonSoft's JSON.Net.

The challenge is that I'm trying to use a simple interface for serializing an IDictionary. T in this case will be one of several entities in my domain that all have a Guid id (which becomes its key in the dictionary).

the problem I'm having is that JSON.Net is successfully serializing the dictionary key values and the Id property of the stored objects, but none of hte other properties (which, at this point, are all simple types). My serialization code is pretty much right off the jSON.Net website:

string json = JsonConvert.SerializeObject(data,Formatting.Indented);

"data" as I said is an IDictionary, and T is (for this test) an "Asset" type which right now just has a Guid ID and a String Name property. The output looks like this:

{
  "d1cb1764-66cd-4cfb-8f51-c0b8457ce00e": {
    "Id": "d1cb1764-66cd-4cfb-8f51-c0b8457ce00e"
  }
}

Thanks.