none
Deserialize List of Dictionary in JSON RRS feed

  • Question

  • Hi,

    I want to deserialize List<Dictionary<string,object>> via JSON. I am using this code:

    List<Dictionary<string, string>> ValueList = JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(data);

    but it return null;

    How can I achieve this?

    Thanks and Regards

    Harsh

    Monday, February 18, 2013 6:37 PM

Answers

  • http://stackoverflow.com/questions/3739094/serializing-deserializing-dictionary-of-objects-with-json-net

    thanks and regard love4csharp

    Wednesday, February 20, 2013 2:20 PM
  • var json = JsonConvert.SerializeObject(listOfDict, new JsonSerializerSettings
        {
            TypeNameHandling = TypeNameHandling.Auto,
            TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple,
        }); ;
    
    var deserialized = JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(json);



    Wednesday, February 20, 2013 6:56 PM

All replies

  • You can use JavaScriptSerializer class

    Muthukrishnan Ramasamy
    net4.rmkrishnan.net
    Use only what you need, Reduce global warming

    Monday, February 18, 2013 7:23 PM
  • http://stackoverflow.com/questions/3739094/serializing-deserializing-dictionary-of-objects-with-json-net

    thanks and regard love4csharp

    Wednesday, February 20, 2013 2:20 PM
  • var json = JsonConvert.SerializeObject(listOfDict, new JsonSerializerSettings
        {
            TypeNameHandling = TypeNameHandling.Auto,
            TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple,
        }); ;
    
    var deserialized = JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(json);



    Wednesday, February 20, 2013 6:56 PM