我有以下的JSON的JSON的選擇:LINQ到某些元素
{"response":[2939,
{"mid":6581,"date":1345018696,"out":0,"uid":84175314,"read_state":1,"title":" ... ","body":"Text1"},
{"mid":6578,"date":1344984256,"out":0,"uid":32438192,"read_state":1,"title":" ... ","body":"Text2"}
]}
使用Newtonsoft JSON庫,我需要選擇只有這一部分(然後將數據添加到我的對象)
{"mid":6581,"date":1345018696,"out":0,"uid":84175314,"read_state":1,"title":" ... ","body":"Text1"}, {"mid":6578,"date":1344984256,"out":0,"uid":32438192,"read_state":1,"title":" ... ","body":"Text2"}
(有源JSON多於2個元件)
我寫到目前爲止以下:
JObject jRes = JObject.Parse(json);
JArray jAr = (JArray)jRes["response"];
var query =
from msg in jAr
select new
{
mid = (int)jAr["mid"],
date = (int)jAr["date"],
outt = (short)jAr["out"],
uid = (int)jAr["uid"],
read_state = (short)jAr["read_state"],
title = (string)jAr["title"],
body = (string)jAr["body"],
};
我想限制查詢跳過數組中的第一個對象,但我不知道該怎麼做。
我不明白'創建限制'是什麼意思。你能解釋一下你的問題嗎? – 2012-08-17 13:47:06
我的意思是如何跳過數組中的第一個對象 - 數字型 (以及所有數據的長期) – chromigo 2012-08-17 15:22:16