Javascript json错误无效的JSON原语:strJson(Javascript json error Invalid JSON primitive: strJson)
我写了一个jQuery演示来发布JSON:
$.ajax({ url: "RoleFunc.aspx/Vonvert", type: "POST", contentType: "application/json; charset=utf-8", dataType: 'json', data: { "strJson": json }, success: function(result) { alert(result); }, error: function() { alert("error"); } });当我使用该函数时,Firebug视图显示为错误消息,如Invalid JSON primitive: strJson.
我测试了JSON,结果是
{ "strJsonssss":[{"Role_ID":"2","Customer_ID":"155","Brands":"Chloe;","Country_ID":"96;"}]}而我的C#func是
[WebMethod] public static int Vonvert(string strJson) { //DataSet dt1 = JsonConvert.DeserializeObject<DataSet>(strJsonssss); return 1; }我调试它,它从来没有进入函数所以...任何身体帮助我...
I've written a jQuery demo to post JSON:
$.ajax({ url: "RoleFunc.aspx/Vonvert", type: "POST", contentType: "application/json; charset=utf-8", dataType: 'json', data: { "strJson": json }, success: function(result) { alert(result); }, error: function() { alert("error"); } });and when I use the function, Firebug view shows as an error message like Invalid JSON primitive: strJson.
I've tested the JSON and the result is
{ "strJsonssss":[{"Role_ID":"2","Customer_ID":"155","Brands":"Chloe;","Country_ID":"96;"}]}and my C# func is
[WebMethod] public static int Vonvert(string strJson) { //DataSet dt1 = JsonConvert.DeserializeObject<DataSet>(strJsonssss); return 1; }I debug it, and it never in to the function so... any body help me...
最满意答案
你错过了收盘报价:
{ "strJsonssss":[{"Role_ID":"2","Customer_ID":"155","Brands":"Chloe;","Country_ID":"96;"}]} --------------^You are missing a closing quote:
{ "strJsonssss":[{"Role_ID":"2","Customer_ID":"155","Brands":"Chloe;","Country_ID":"96;"}]} --------------^更多推荐
发布评论