Antoine Antoine - 10 months ago 70
JSON Question

Strange JSON Deserialization c#

I'm having troubles with some Deserialization because I'm not receiving an object like I'm used to but an array. Lets to the code, how I've being doing it:

JSON received:



var result = JsonConvert.DeserializeObject<Gcm>(response);

Handlers Tried:

public class Gcm
public List<Gcm_reg> gcm_regID { get; set; }
public class Gcm_reg
public string gcm_regID { get; set; }

I've tried just the Gcm_reg as well and nothing seems to work. How can I deserialize this? By the way, I'm using the newsoft JSON.

Best regards,

 IEnumerable<Gcm_reg> result =  JsonConvert.DeserializeObject<IEnumerable<Gcm_reg>>(response);

You can deserialize the object as an array or IEnumerable