tags:

views:

439

answers:

1

I have some JSON-

[{\"crudtype\":\"Update\",\"objectid\":\"11\",\"attributes":[{\"CREATED_BY\":\"OSPLOADER\",\"x\":\"y\"}]}]

Having difficulty with getting the "attributes" out. I'm using DataContractJsonSerializer in combination with ISerializable from this example.

    protected Attributes(SerializationInfo info, StreamingContext context)
   {
       dict = new Dictionary<string, string>();
       foreach (SerializationEntry entry in info) {
           dict.Add(entry.Name, entry.Value.ToString());
       }
   }

Everything is fine if my attributes is not an array (i.e. doesn't have the enclosing []). But if it's an array (which, alas, it is) then when I get to SerializationInfo, I get one entry which is named "item" and of type "object". It doesn't appear as if I can cast it to anything at all. Any ideas before I bludgeon the incoming JSON with Regex (there is only ever one entry in this array)?

Thanks

A: 

This isn't an answer but a poke as I have the same issue, anyone got a solution to this?

mtopley