[C#.net] 產生JSON字串的幾種方式整理(轉)
//用Linq直接組
var result = new
{
collapse_key = "score_update",
time_to_live = 108,
delay_while_idle = true,
data = new{
score ="4x8",
time = "15:16.2342"
},
registration_ids = from s in registration_ids
select s
};
//序列化為JSON字串並輸出結果
Response.Write(JsonConvert.SerializeObject(result));