0
I made an application in C#(Winforms) to load the marks according to the type of vehicle that is selected (car, bike or walking)in a combobox. I put in a button the following code:
private void btnCheck_Click_1(object sender, EventArgs e)
{
Object tipoVeic = cmbTipo.SelectedItem;
WebClient client = new WebClient();
var url = "http://fipeapi.appspot.com/api/1/" + tipoVeic.ToString() + "/veiculos/21.json";
var json = client.DownloadString(url);
var serializar = new JavaScriptSerializer();
var model = serializar.Deserialize<dynamic>(json);
lblTipo.Text = tipoVeic.ToString();
lblTipo.Visible = true;
cmbMarca.Items.AddRange(model);
}
When click will load the combobox 'Tag'. What happens is that when I click on load the combobox is filled with information (Collection) repeatedly, as shown below.
Maybe I’m missing some information from the array, but I honestly don’t know what to do in this case. If it is not very clear, let me know that I try to specify better in the comments.
Thanks
worked dude, I used JSON.NET as you passed me, thank you very much!
– Stephen Willians