小编Sin*_*dra的帖子

无法将Newtonsoft.Json.Linq.JArray转换为Newtonsoft.Json.Linq.JToken.当我通过json时出错

我需要将检查过的复选框代码传递给JavaScript中的C#.我能够通过JSON发送代码.我的JSON值是JArray.我在标题中得到了例外.

JSON:

{
  "Items": [
    "100066",
    "100067"
  ]
}
Run Code Online (Sandbox Code Playgroud)

C#:

public ActionResult UpdateTransportRequests()       
{
    string json;
    using (var reader = new StreamReader(Request.InputStream))
    {
        json = reader.ReadToEnd();
    }

    JObject jo = (JObject)JsonConvert.DeserializeObject(json);

    string lineItems = jo.Value<string>("Items");

    RequestDataAccess rda = new RequestDataAccess();
    decimal reqId = decimal.Parse(lineItems);
    rda.ApproveReject_Request(reqId, "A", "");

    return Json(new { result = "success" });
}
Run Code Online (Sandbox Code Playgroud)

客户端:

function approveAll(requestid) {
    var items = [];

    $('#grid tbody').find('input:checkbox:checked').each(function (index, item) {
        var rowIndex = $(this).closest('tr').index();
        items.push($('#grid tbody').find('tr:eq(' + rowIndex + ')').find('td:eq(1)').text().replace('TR-', ''));

    }); …
Run Code Online (Sandbox Code Playgroud)

c# json json.net

9
推荐指数
2
解决办法
4万
查看次数

Why I can not import the following GeoJson data into Google map

What's wrong with the GeoJson data.

data= {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"letter":"f"},"geometry":{"type":"Polygon","coordinates":[[[-0.467823,51.8881],[-0.461189,51.883591],[-0.45952,51.882457],[-0.4584,51.881558],[-0.455638,51.87973],[-0.453644,51.879704],[-0.447352,51.879806],[-0.442062,51.879798],[-0.439082,51.879388],[-0.435922,51.878419],[-0.433059,51.877516],[-0.430189,51.876799],[-0.427409,51.876391],[-0.424125,51.8761],[-0.420636,51.875991],[-0.419732,51.876164],[-0.41987,51.877772],[-0.41932,51.879371],[-0.418517,51.879484],[-0.417789,51.880339],[-0.415227,51.88222],[-0.419205,51.882644],[-0.426901,51.885218],[-0.428296,51.886369],[-0.429248,51.885188],[-0.431001,51.885025],[-0.431131,51.884162],[-0.431451,51.883549],[-0.434041,51.883707],[-0.435319,51.88428],[-0.438299,51.88469],[-0.440777,51.885217],[-0.443263,51.885497],[-0.445256,51.885585],[-0.446127,51.8864],[-0.44839,51.887356],[-0.449782,51.887498],[-0.455175,51.887446],[-0.458568,51.88749],[-0.462862,51.887423],[-0.465357,51.887455],[-0.467487,51.888167]]]}}]}
Run Code Online (Sandbox Code Playgroud)

am adding it as map.data.addGeoJson(data); and getting the error below. 在此处输入图片说明

Thanks in advance.

google-maps geojson

1
推荐指数
1
解决办法
644
查看次数

标签 统计

c# ×1

geojson ×1

google-maps ×1

json ×1

json.net ×1