在VB.NET中将JSON转换为GridView

时间:2016-05-04 19:46:07

标签: json vb.net json.net

我有以下JSON,我希望转换为GridView。我已经能够成功地为JSON的一部分执行此操作。它似乎在存款和取款部分失败了。有人有什么建议吗?

{
  "results": [
    {
      "id": "51142254",
      "tp_id": "!XP4D49X0CD123628",
      "firstname": "Owner",
      "lastname": "Operator",
      "email": "",
      "phone": "",
      "enrolled": "1",
      "balance": 247.54,
      "fleet": "Test Express",
      "deposits": [
        {
          "id": "184022380",
          "date": "2016-02-17",
          "amount": "200.00",
          "transID": "135246",
          "memo": "Scheduled Deposit",
          "status": "Cleared"
        },
        {
          "id": "184022383",
          "date": "2016-02-25",
          "amount": "200.00",
          "transID": "246357",
          "memo": "Scheduled Deposit",
          "status": "Cleared"
        },
        {
          "id": "184022386",
          "date": "2016-03-02",
          "amount": "200.00",
          "transID": "975468",
          "memo": "Scheduled Deposit",
          "status": "Cleared"
        }
      ],
      "withdrawals": [
        {
          "id": "184026949",
          "date": "2016-03-09",
          "amount": "352.46",
          "transID": "395920",
          "memo": "Invoice\r\n\r\n100234",
          "status": "Cleared"
        }
      ]
    },
    {
      "id": "51142326",
      "tp_id": "!XP4D49X7CD123612",
      "firstname": "Owner",
      "lastname": "Operator",
      "email": "",
      "phone": "",
      "enrolled": "1",
      "balance": 0,
      "fleet": "Test\r\nExpress",
      "deposits": [],
      "withdrawals": []
    }
  ]
}

这是我用于GridView的当前代码。

Dim UserList As List(Of api_Test_Deposit) = JsonConvert.DeserializeObject(Of List(Of api_Test_Deposit))(GetUrlString(searchType, searchValue))
Dim table = JsonConvert.DeserializeObject(Of DataTable)(GetUrlString(searchType, searchValue))
Return table

0 个答案:

没有答案