Need to de-serialize an array of array response to List<Model>
This is my response from other endpoint:
"[[{"BillRateCardId":6992,"ExternalRateCardId":"cd77d9b5-a00e-4696"}]]"
Am using the below line of code to deserialize it to the Model but receiving the error "cant de-serialize that":
List<Model> Res = JsonConvert.DeserializeObject<List<Model>>(Response);
2
Answers
You need to specify the data type that
List
is expected to contain, either by modeling it as an object:or by using
dynamic
, but then you lose static type checking:since you have only one value, you don’t need the custom class