c# - Creating an array from json String variable -


"[\"1454\",\"1455\",\"1456\",\"1457\",\"1458\",\"1459\"]"

i getting json string in string variable in action method sending json.stringify. these id's of selected rows jqgrid..

i want create array of id's getting . not want others backslash or forward or double qutes.

can pl.help me . how possible in c#

controller::  public actionresult exportselecteddata(string selectedrows)         { }  view code:: function gengraph() {         // location.href = "/webreports/batchreport";         var selrowids = $("#list1").jqgrid('getgridparam', 'selarrrow');         var array = json.stringify(selrowids);          $.ajax({             type: 'post',             url: '/webreports/exportselecteddata',             data: "{'selectedrows':'" + array + "'}",             contenttype: 'application/json; charset=utf-8',             datatype: 'json',             success: function (returnvalue) {                 location.href = "/webreports/download?file=" + returnvalue.file;             }         });         alert(array); 

this should work use newtonsoft.json library

string[] strings = jsonconvert.deserializeobject<string[]>(jsondata); 

below fiddle

http://dotnetfiddle.net/t5kboy


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -