在VB.net中获取JSON对象的值 [英] Get value of JSON object in VB.net

查看:375
本文介绍了在VB.net中获取JSON对象的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下将在C#中使用的代码:

I have the following code I would use in C#:

    var tokenJson = JsonConvert.SerializeObject(tokenJsonString);

    var jsonResult = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(jsonString);
    var firstItem = jsonResult["data"][0];

但是,我有一个VB.NET客户端,而且我不知道如何翻译它.我尝试了其他在线工具,但没有结果.

However, I have a VB.NET client, and I have no idea how to translate it. I have tried different online tools without a result.

我有这样的JSON响应:

I have a JSON response like this:

"{\"token\":\"1edd6006-678a-4e6a-ab65-4fa60efa8632\"}"

我只想要令牌的值.在VB.NET;)

And I just want the value of the token. In VB.NET ;)

推荐答案

尝试一下:

 Dim tokenJson = JsonConvert.SerializeObject(tokenJsonString)

 Dim jsonResult = JsonConvert.DeserializeObject(Of Dictionary(Of String, Object))(jsonString)
 Dim firstItem = jsonResult.Item("data").Item(0)

欢呼

这篇关于在VB.net中获取JSON对象的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆