Note that there are some explanatory texts on larger screens.

plurals
  1. POList to JSON in asp.net
    primarykey
    data
    text
    <p>I am receiving bad JSON from server which is a string of actual array so I was using JSON.parse. I looked the asp code and I found that developers are converting list to JSON. What is the best way to encode list to JSON format? </p> <p>Data that I am getting : {d:"[\\"[5970,5971,5972,5973,5976,5974,5975,5977,5978],[343,232]\\"]"}</p> <p>Data should look like this : {d:[[5970,5971,5972,5973,5976,5974,5975,5977,5978],[343,232]]}</p> <p>This is a tiny bit of JSON but it is 5MB of JSON so parsing takes lot of time.</p> <p>I will really appreciated if someone can help me to find out solution for this as I am a UI guy. <a href="http://jsfiddle.net/aavUA/19" rel="nofollow">http://jsfiddle.net/aavUA/19</a></p> <p>The asp code is which is actually calling c sharp function:</p> <pre><code>public static string GetLevelChildsList(string strInputString) { List&lt;IndexReleationship&gt; inflationRelationship = SessionManager.InflationRelation; string[] inputArguments = strInputString.Split('~'); int intInflationModelLevelID = int.Parse(inputArguments[0].Trim()); List&lt;string&gt; lstResultString = new List&lt;string&gt;(); List&lt;List&lt;int&gt;&gt; strList = new List&lt;List&lt;int&gt;&gt;(); List&lt;int&gt; strInflationHideIdList = new List&lt;int&gt;(); List&lt;int&gt; strInflationShowIdList = new List&lt;int&gt;(); List&lt;int&gt; strActualLevelids = new List&lt;int&gt;(); List&lt;int&gt; selectedLevelids = new List&lt;int&gt;(); for (int count = 0; count &lt; inflationRelationship.Count; count++) { if (inflationRelationship[count].IsReleatedIndex &gt; intInflationModelLevelID) { if (!strInflationHideIdList.Contains(inflationRelationship[count].ParentIndexID)) { strInflationHideIdList.Add(inflationRelationship[count].ParentIndexID); } if (!strInflationHideIdList.Contains(inflationRelationship[count].ChildIndexID)) { strInflationHideIdList.Add(inflationRelationship[count].ChildIndexID); } } else if (inflationRelationship[count].IsReleatedIndex == intInflationModelLevelID &amp;&amp; inflationRelationship[count].IsReleatedIndex != 1169) { if (!strActualLevelids.Contains(inflationRelationship[count].ChildIndexID)) { strActualLevelids.Add(inflationRelationship[count].ChildIndexID); } } else { if (!strInflationShowIdList.Contains(inflationRelationship[count].ParentIndexID)) { strInflationShowIdList.Add(inflationRelationship[count].ParentIndexID); } if (!strInflationShowIdList.Contains(inflationRelationship[count].ChildIndexID)) { strInflationShowIdList.Add(inflationRelationship[count].ChildIndexID); } } } strList.Add(strInflationHideIdList); strList.Add(strInflationShowIdList); strList.Add(strActualLevelids); selectedLevelids.AddRange(strInflationShowIdList); selectedLevelids.AddRange(strActualLevelids); string strResult = GetSessionInflationModels(selectedLevelids); lstResultString.Add(strList.ToJson()); lstResultString.Add(strResult); return lstResultString.ToJson(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload