如何将其反序列化为变量?C #。请举个例子,已经第二天了,还没有到图书馆 JSON.NET
{"messages":[{"text":"TEXT MESSAGE","channel":"main":"from":"USERNAME","fromid":651765,"t":1379970985409,"tc":"f16d7e"}}}
所以
void timer_Tick(object sender, EventArgs e)
{
string json = @"{""messages"":[{""text"":""TEXT MESSAGE"",""channel"":""main"":""from"":""USERNAME"",""fromid"":651765,""t"":1379970985409,""tc"":""f16d7e""}}} ";
dynamic stuff = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
string color = stuff.text;
label1.Text = color;
}
解析值后遇到意外字符::. 路径'messages[0].channel',第 1 行,位置 52。