使用 JSON.NET 解析 PHP 生成的 JSON
我确信之前已经有人问过这个问题,但我没有找到我需要的信息,所以我想我应该发布这个。
我编写了一个 PHP 脚本,它返回一个简单的 JSON 对象,如下所示:
{"status":"success","level":"admin"}
我正在执行一个标准 Web 请求,将所需的数据提交到通过互联网编写脚本,效果很好。
现在,我想使用 JSON.NET 提取各个变量,这样我就可以知道“状态”和“级别”的值是什么。问题是,我不知道从哪里开始。
我在 VB.NET(在 .NET Compact Framework 上)中执行此操作。有人可以帮助我吗?我在谷歌上花了两个小时,却一无所获!
谢谢!
I'm sure this has been asked before but I'm not finding quite the information I'm needing so I thought I'd post this.
I've written a PHP script that returns a simple JSON object that looks like this:
{"status":"success","level":"admin"}
I'm doing a standard web request that submits the required data to the script over the internet and that's working fine.
Now, I want to use JSON.NET to pull out the individual variables so I can know what the values of "status" and "level" are. The problem is, I have no idea where to start.
I'm doing this in VB.NET (on the .NET Compact Framework). Can anyone help me? I've spent the last 2 hours on Google and can come up with nothing!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为下面的代码片段会有用。
从此处粘贴内容 http://msdn.microsoft.com/en -us/library/bb299886.aspx#intro_to_json_topic5
i think below code snippet will be useful.
Pasting the content from here http://msdn.microsoft.com/en-us/library/bb299886.aspx#intro_to_json_topic5