public object ComplexWithListFromQuery([FromQuery] ModelWithArray fromQueryModel) { return(new { simple = fromQueryModel.SimpleType, array = fromQueryModel.ArrayType, }); }
public static void Main(params string[] args) { //string json = "{\"TotalRecords\":2,\"Result\":[{\"Id\":24379,\"AccountName\":\"foo\"},{\"Id\":37209,\"AccountName\":\"bar\"}], \"ResponseCode\":0,\"Status\":\"OK\",\"Error\":\"None\"}"; string json = "{\"Result\":{\"Id\":24379,\"AccountName\":\"foo\"},\"ResponseCode\":0,\"Status\":\"OK\",\"Error\":\"None\"}"; if (checkIsArray(json)) { ModelWithArray data = JsonConver.DeserializeObject <ModelWithArray>(json); } else { ModelWithoutArray data = JsonConver.DeserializeObject <ModelWithoutArray>(json); } }