Antoine Antoine - 4 months ago 15x
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