我有以下 JSON:
{"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"],
};
我想限制查询以跳过数组中的第一个对象,但我不知道该怎么做。