【问题标题】:string to JsonObject in C#字符串到 C# 中的 JsonObject
【发布时间】:2010-05-28 15:46:34
【问题描述】:

将(正确 Json 格式的)String 对象转换为System.Json.JsonObject 的最佳方法是什么?现在我创建一个StringReader 并使用System.Json.JsonObject.Load

(这确实有点学术,因为我认为我将始终处理System.IO.Stream 形式的原始Json。)

【问题讨论】:

  • 你为什么要处理 Json raw?
  • 我的意思是,我永远不会拥有 String 格式的 Json,它总是来自 Stream 中的 Web 服务。

标签: c# silverlight json


【解决方案1】:

您可以简单地使用System.Json.JsonValue.Parse 静态方法直接解析字符串,而不是使用StringReader

【讨论】:

  • 哇,我怎么会错过那个。谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-09-16
  • 2013-10-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-03
相关资源
最近更新 更多