本文介绍了从json响应中获取数据。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要从给定的json响应中检索id等事务详细信息。



Hi all,
I need to retrieve the transaction details like id from given json response.

{
  "id": "PAY-85619955UR925572LKJLINZY",
  "create_time": "2013-10-10T10:52:23Z",
  "update_time": "2013-10-10T10:52:59Z",
  "intent": "sale",
  "payer": {
    "payment_method": "paypal",
    "payer_info": {
      "email": "[email protected]",
      "first_name": "Sujeet",
      "last_name": "Singh",
      "payer_id": "HCN5UA7K9PPJJ"
    }
  },
  "transactions": [
    {
      "amount": {
        "currency": "USD",
        "total": "2345.00",
        "details": {
          "subtotal": "2345.00"
        }
      },
      "description": "Transaction description.",
      "related_resources": [
        {
          "sale": {
            "id": "57J06778HJ9237740",
            "create_time": "2013-10-10T10:52:23Z",
            "update_time": "2013-10-10T10:52:59Z",
            "amount": {
              "currency": "USD",
              "total": "2345.00"
            },
            "state": "pending",
            "parent_payment": "PAY-85619955UR925572LKJLINZY",
            "links": [
              {
                "href": "https://api.sandbox.paypal.com/v1/payments/sale/57J06778HJ9237740",
                "rel": "self",
                "method": "GET"
              },
              {
                "href": "https://api.sandbox.paypal.com/v1/payments/sale/57J06778HJ9237740/refund",
                "rel": "refund",
                "method": "POST"
              },
              {
                "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-85619955UR925572LKJLINZY",
                "rel": "parent_payment",
                "method": "GET"
              }
            ]
          }
        }
      ]
    }
  ],
  "state": "pending",
  "links": [
    {
      "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-85619955UR925572LKJLINZY",
      "rel": "self",
      "method": "GET"
    }
  ]
}





这是我得到json的字符串。



String json =(String )CurrContext.Items [ResponseJson];



任何帮助都会真正贬值。

谢谢



And this is the string where i am getting json.

String json = (String)CurrContext.Items["ResponseJson"];

Any help will really apreciated.
Thanks

推荐答案




这篇关于从json响应中获取数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 11:25