hello
i am using but it gives me desrialized error on page load, here is full page behind code
Cannot deserialize the JSON array (e.g. [1,2,3]) into type because type requires JSON object (e.g. {“name”:“value”}) to deserialize correctly
protected void Page_Load(object sender, EventArgs e)
{
var client = new RestClient("https://api.shipengine.com/v1/rates/estimate");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("API-Key", "TEST_fNMcdeWurY4XH/Gc8gRntu3S95NewkLf2LVZcocrzi8");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n\t\"carrier_id\": \"se-123456\",\n\t\"from_country_code\": \"US\",\n\t\"from_postal_code\": \"78756\",\n\t\"to_country_code\": \"US\",\n\t\"to_postal_code\": \"91521\",\n\t\"weight\": {\n\t\t\"value\": 17,\n\t\t\"unit\": \"pound\"\n\t}\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
var daa = response.Content;
Root myDeserializedClass = Newtonsoft.Json.JsonConvert.DeserializeObject<Root>(daa);
ShipFrom shipFrom = myDeserializedClass.ship_from;
List<OutData> outData = new List<OutData>();
foreach (Rate rate in myDeserializedClass.rate_response.rates)
{
OutData od = new OutData();
od.name = shipFrom.name;
od.phone = shipFrom.phone;
od.company_name = Convert.ToString(shipFrom.company_name);
od.address_line1 = shipFrom.address_line1;
od.address_line2 = Convert.ToString(shipFrom.address_line2);
od.address_line3 = Convert.ToString(shipFrom.address_line3);
od.currency = rate.shipping_amount.currency;
od.amount = rate.shipping_amount.amount;
od.carrier_code = rate.carrier_code;
od.carrier_nickname = rate.carrier_nickname;
od.carrier_friendly_name = rate.carrier_friendly_name;
outData.Add(od);
}
GridView1.DataSource = outData;
GridView1.DataBind();
}