如何在Rest API中传递JSON数组和对象

时间:2019-10-31 12:03:35

标签: c# json rest api

我想在Rest API中传递到JSON以下

$("table.order-list").on("click", ".ibtnDel", function(_event) {
  $(this).closest("tr").remove();
  counter -= 1
  evaluateTotal()
});

$('body').on('change', '[data-action="sumDebit"]', function() {
  evaluateTotal();
});


function evaluateTotal() {
  var total = 0;
  $('[data-action="sumDebit"]').each(function(_i, e) {
    var val = parseFloat(e.value);
    if (!isNaN(val))
      total += val;
  });
  $('#totaldbt').val(total);
}

我会尝试以下方法,但效果不佳

{"fulfillment":{"order_id":67584463,"tracking_number":"555555","tracking_url":"test.com","fulfillment_line_items":[{"order_line_item_id":186994328,"quantity":1}]}}

1 个答案:

答案 0 :(得分:0)

只需使用AddBody方法即可传递正文。

var client = new RestClient("XXXXX");    
var request = new RestRequest(Method.POST);   
requst.AddBody = (jsonString); //Your json string goes here