Parse strange JSON response as List <string>

I am calling the webservice using RestSharp and will get my response back correctly, but the data I am returning is kind of a weird format. These are a list of GUIDs that I also want, but they return as a bool object or something like that: take a look

"{
    \"5916DF70-C413-4132-90F7-C365B0FAA26D\" : true,
    \"B5F0FF80-F8D1-40F7-8313-045F02D37FAA\" : true,
    \"D859A904-EDAE-4D87-9ADC-8FB5F3B47B02\" : true
}"

      

How would I parse this so I just get a list containing only the GUIDs?

+3


source to share


1 answer


You cannot parse this answer in the list, it looks more like a dictionary



var result = JsonConvert.DeserializeObject<Dictionary<Guid, bool>>(json);
var resultlist = result.Select(c => c.Key).ToList();   

      

+13


source







All Articles