1

我有服务器发送给我的键值 JToken。我如何通过 json.net 做同样的事情?

例子:

{
  "1_type": "sound",
  "1url": "http://example.com/sound.mp3",
  "2_type": "url",
  "2url": "http://example.com",
}
4

1 回答 1

3

使用Json.Net

JObject jObj = new JObject();
jObj["1_type"] = "sound";
jObj["1url"] = "http://example.com/sound.mp3";
jObj["2_type"] = "url";
jObj["2url"] = "http://example.com";
var jsonString = jObj.ToString();
于 2012-08-21T19:43:22.683 回答