我的应用程序可以毫无问题地接收easypost webhook帖子,但是在此之后,我需要浏览POST请求正文以访问ID和状态。这是POST正文JSON
{
"result": {
"id": "trk_6834f5d9483a44d0b07e17a9131946ac",
"object": "Tracker",
"mode": "test",
"tracking_code": "EZ2000000002",
"status": "in_transit",
"status_detail": "arrived_at_facility",
"created_at": "2019-07-18T16:35:10Z",
"updated_at": "2019-07-18T16:35:11Z",
"signed_by": null,
"weight": 17.6,
"est_delivery_date": "2019-07-18T16:35:10Z",
"shipment_id": null,
"carrier": "FedEx",
"tracking_details": [
{
"object": "TrackingDetail",
"message": "Shipment information sent to FedEx",
"description": null,
"status": "pre_transit",
"status_detail": "status_update",
"datetime": "2019-06-19T06:59:10Z",
"source": "FedEx",
"carrier_code": null,
"tracking_location": {
"object": "TrackingLocation",
"city": null,
"state": null,
"country": null,
"zip": null
}
},
...
}
我在访问特定的JSON数据时遇到问题。这是接收请求的我的控制器。
async public void PostObject([FromBody] JObject request)
{
Console.Write(request);
var stuff1 = request.ToString();
如何解析JSON主体并获取对象的特定部分? 当我谈到C#时,我很迷茫