I want to send data of object to my Web API. The API accepts a parameter of class, which properties are type of int and string.
This is my class:
public class deneme
{
public int ID { get; set; }
public int sayi { get; set; }
public int reqem { get; set; }
public string yazi { get; set; }
}
This is my JSON object:
{
"id":0,
"sayi":"9",
"reqem":8,
"yazi":"sss"
}
I want the api read the property "sayi" as integer.
but because it cant, it gives the error:
The JSON value could not be converted to System.Int32. Path: $.sayi
How could I solve this problem?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…