无法将linq查询输出转换为.net中的json数据

时间:2016-06-27 08:32:04

标签: c# json linq

我希望得到温度列的5个前10个记录,并希望转换为json数据。我试过这样但没有得到理想的值

{"成功":真," sensorsdata" {" WaterTemperature":" 33.33"}}

  using (smartpondEntities DB = new smartpondEntities())
                {
                    var parkingSlot = DB.ParkingSlots.OrderByDescending(x => x.CurrentTime).Select(x => x.WaterTemperature).Take(5);

                    return Json(new { success = true, sensorsdata = new { WaterTemperature = "33.33" } }, JsonRequestBehavior.AllowGet);
                }

0 个答案:

没有答案