我有服务器发送给我的键值 JToken。我如何通过 json.net 做同样的事情?
例子:
{
"1_type": "sound",
"1url": "http://example.com/sound.mp3",
"2_type": "url",
"2url": "http://example.com",
}
使用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();