Я пытаюсь отобразить ответ json.
У меня ниже код ответа json
string JSON = await SendGraphRequest("/users/", $"$filter=signInNames/any(x:x/value eq '{username}')", null, HttpMethod.Get);
это ответ JSON
{
"extension_7182f7a071344106a9e47cc960ab93e8_DOB": null,
"extension_7182f7a071344106a9e47cc960ab93e8_middleName": null,
"objectID": "",
"accountEnabled": true,
"email": Test
}
Я хочу десериализовать ответ json, используя приведенный ниже код
var graphUserRespModel = JsonConvert.DeserializeObject<ResponseModelPrime>(JSON);
Я использую три класса для DeserializeObject, но я получаю нулевое значение во всех полях. пожалуйста, дайте мне знать, какую ошибку я совершаю.
public class ResponseModelPrime
{
[JsonProperty(PropertyName = "odata.metadata")]
public string OdataMetadata { get; set; }
[JsonProperty(PropertyName = "Status")]
public StatusModel Status { get; set; }
[JsonProperty(PropertyName = "objectId")]
public string ObjectId { get; set; }
[JsonProperty(PropertyName = "email")]
public string Email { get; set; }
[JsonProperty(PropertyName = "accountEnabled")]
public bool AccountEnabled { get; set; }
[JsonProperty(PropertyName = "DOB")]
public string DOB { get; set; }
[JsonProperty(PropertyName = "middleName")]
public string middleName { get; set; }
}
public class ResponseModel
{
[JsonProperty(PropertyName = "objectId")]
public string ObjectId { get; set; }
[JsonProperty(PropertyName = "email")]
public string Email { get; set; }
[JsonProperty(PropertyName = "accountEnabled")]
public bool AccountEnabled { get; set; }
}
public class ResponseModelSIT : ResponseModel
{
[JsonProperty(PropertyName = "extension_7182f7a071344106a9e47cc960ab93e8_DOB")]
public string extension_7182f7a071344106a9e47cc960ab93e8_DOB { get; set; }
[JsonProperty(PropertyName = "extension_7182f7a071344106a9e47cc960ab93e8_middleName")]
public string extension_7182f7a071344106a9e47cc960ab93e8_middleName { get; set; }
}