C# try to get information from the endpoints
Hey,
I am programming for a while, but never tried to make some API's. If Itry to get information by the endpoints I always get fault message. If the endpoint information is only 1 line (1country) I don't get faults but more countries or states I have.

thank you in advance
You are getting an array with the objects of countries. You may try deserialize this way List<Idictionary> or else you can create a model class with the properties name matching to properties of each country in the endpoint and put it instead of Idictionary
I'm making a version in C#, too. See my repo and see what i'm doing.
@GowthamF thank you for your respond
also tried this:
class Country and class Country_collection
Country_collection resultCountry = JsonConvert.DeserializeObject<Country_collection>(json);
but same error
Why not create a class, and deserialize in a object?
Class Country
[JsonProperty("country")]
public string Country { get; set; }
[JsonProperty("cases")]
public string Cases { get; set; }
[JsonProperty("todayCases")]
public string TodayCases { get; set; }
And following line:
JsonConvert.DeserializeObject<YourClassesGoesHere>(json)
I really aprreciate your help but still got this error message
public partial class Country_collection { [JsonProperty("country")] public string Country { get; set; }
[JsonProperty("cases")]
public long Cases { get; set; }
[JsonProperty("todayCases")]
public long TodayCases { get; set; }
[JsonProperty("deaths")]
public long Deaths { get; set; }
[JsonProperty("todayDeaths")]
public long TodayDeaths { get; set; }
[JsonProperty("recovered")]
public long Recovered { get; set; }
[JsonProperty("active")]
public long Active { get; set; }
[JsonProperty("critical")]
public long Critical { get; set; }
[JsonProperty("casesPerOneMillion")]
public long CasesPerOneMillion { get; set; }
}
public partial class Country_collection
{
public static Country_collection[] FromJson(string json) => JsonConvert.DeserializeObject<Country_collection[]>(json, Corona_stats.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this Country_collection[] self) => JsonConvert.SerializeObject(self, Corona_stats.Converter.Settings);
}
internal static class Converter
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters =
{
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
};
}
and

Can you put your repo on GitHub?
Corona_stats.Converter.Settings what is this "settings"?
This is not an issue related to the api. Closing. Join our discord server if you really need help :)
@ME9114E Let me help you. Drop me a mail [email protected]