duanpuchen3142 2016-04-28 04:54
浏览 1154
已采纳

如何在VB.net中获取JSON数组或对象的值?

I have JSON file having following data. I just want to get the data of "naming" and "unit". Please assist me how to do this in VB.net?

[
        {
            "customerId": "999",
            "deviceId": "XXX999",
            "searchDeviceId": "D_XXX999",
            "utc": "2016-04-28T03:37:00.000Z",
            "lat": 22.5691,
            "lng": 120.3058,
            "sensors": [
                {
                    "naming": "ABC123",
                    "factor": null,
                    "unit": "k",
                    "period": null
                },
                {
                    "naming": "XYZ123",
                    "factor": null,
                    "unit": "c",
                    "period": null
                },
                .
                .
                .
                .
                .
            ]
        }
    ]
  • 写回答

2条回答 默认 最新

  • duankousong9637 2016-04-28 05:21
    关注

    For C# :

    JObject jResults = JObject.Parse("JsonString");
    String naming = jResults["sensors"]["naming "];
    String unit = jResults["sensors"]["unit "];
    

    For VB:

    Dim jResults As JObject = JObject.Parse("JsonString")
    Dim naming As [String] = jResults("sensors")("naming ")
    Dim unit As [String] = jResults("sensors")("unit ")
    

    You can achieve like this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 gis中用栅格计算器或加权总和后图层不显示,值也明显不对
  • ¥15 python使用python-pptx如何给幻灯片添加只读密码。
  • ¥15 深度神经网络传递自变量损失
  • ¥15 删除s的前驱节点,但是不知道错哪里了
  • ¥15 oracle数据库备份表如何操作
  • ¥15 软件定义网络mininet和onos控制器问题
  • ¥15 微信小程序 用oss下载 aliyun-oss-sdk-6.18.0.min client报错
  • ¥15 ArcGIS批量裁剪
  • ¥15 labview程序设计
  • ¥15 为什么在配置Linux系统的时候执行脚本总是出现E: Failed to fetch http:L/cn.archive.ubuntu.com