Jose Saiz

Jose Saiz

  • 1.5k
  • 260
  • 102.2k

I Need Help Parsing JSON

Oct 22 2023 3:21 PM

Hi Guys

I really appreciate the help parsing out this JSON result 

{"result_count":1,"results":[{"created_epoch":"1151241154000","enumeration_type":"NPI-1","last_updated_epoch":"1630682512000","number":"1427084888","addresses":[{"country_code":"US","country_name":"United States","address_purpose":"LOCATION","address_type":"DOM","address_1":"6101 WEBB RD STE 301","city":"TAMPA","state":"FL","postal_code":"336152866","telephone_number":"813-885-3600","fax_number":"813-885-4600"},{"country_code":"US","country_name":"United States","address_purpose":"MAILING","address_type":"DOM","address_1":"6101 WEBB RD STE 301","city":"TAMPA","state":"FL","postal_code":"336152866"}],"practiceLocations":[],"basic":{"first_name":"ALEJANDRO","last_name":"CINTAS","middle_name":"R","credential":"MD","sole_proprietor":"NO","gender":"M","enumeration_date":"2006-06-25","last_updated":"2021-09-03","certification_date":"2021-09-03","status":"A"},"taxonomies":[{"code":"207R00000X","taxonomy_group":"","desc":"Internal Medicine","state":"FL","license":"ME0080234","primary":false},{"code":"207Q00000X","taxonomy_group":"","desc":"Family Medicine","state":"FL","license":"ME80234","primary":true}],"identifiers":[{"code":"05","desc":"MEDICAID","issuer":null,"identifier":"259401300","state":"FL"}],"endpoints":[],"other_names":[]}]}

 

Here it is my code I only posting a few of the result but I would like to get them all value from the JSON string.

Physicians DoctorInfo = new Physicians();
string info = new WebClient().DownloadString(apiUrl);

JavaScriptSerializer jsonObject = new JavaScriptSerializer();
DoctorInfo = jsonObject.Deserialize<Physicians>(info);

//- Result values are coming as null for all the properties
Console.WriteLine(DoctorInfo.number);

internal class Physicians
{
    public string first_name { get; set; }
    public string last_name { get; set; }
    //country
    public string country_code { get; set; }
    public string country_name { get; set; }
    public string city { get; set; }
    public string state { get; set; }            
    public string postal_code { get; set; }
    public string telephone_number { get; set; }
    public string fax_number { get; set; }
    public string number { get; set; }
    public string TimeZone { get; set; }
}

Thanks

JS.


Answers (5)