0

I have the following json I am trying to get into a dictionary with a key and list of the values pair.

string json = "{ \"customer\": [{\"timestamp\": \"2021-08-16T15:09:46.321+01:00\",\"isvalid\": \"true\",\"status\": \"active\",\"customerid\": \"8994467\"   }],   \"building\": [{\"timestamp\": \"2021-08-16T15:09:46.435+01:00\",\"isvalid\": \"true\",\"type\": \"office\",\"status\": \"active\" }]}";
    
var dict = JsonConvert.DeserializeObject<Dictionary<string, List<ValuesPair>>>(json);
    
public class ValuesPair
{
   public string Name { get; set; }
   public string Value { get; set; }
}

The dictionary gets the two elements customer and building, but the list for each of them consists of only one ValuesPair object which also is empty. How can I fix this?

0 Answers0