私はJSON.parseを使用していたので実際の配列の文字列であるサーバーから悪いJSONを受け取りました。私はASPコードを見て、私は開発者がJSONにリストを変換していることがわかった。リストをJSON形式にエンコードする最良の方法は何ですか?私は取得していますasp.netのJSONへのリスト
データ: {D: "[\\" [5970,5971,5972,5973,5976,5974,5975,5977,5978]、[343232] \\ "]"}
このようになりますデータ: {D:[5970,5971,5972,5973,5976,5974,5975,5977,5978]、[343232]]}
これはJSONのほんの少ししかし5MBのJSONで、解析に時間がかかります。
私がUIの人であるので、誰かが私のために解決策を見つけるのを助けることができれば、本当にありがとうと思います。 http://jsfiddle.net/aavUA/19
ASPコードは、実際にはCシャープ関数を呼び出すされている。
public static string GetLevelChildsList(string strInputString)
{
List<IndexReleationship> inflationRelationship = SessionManager.InflationRelation;
string[] inputArguments = strInputString.Split('~');
int intInflationModelLevelID = int.Parse(inputArguments[0].Trim());
List<string> lstResultString = new List<string>();
List<List<int>> strList = new List<List<int>>();
List<int> strInflationHideIdList = new List<int>();
List<int> strInflationShowIdList = new List<int>();
List<int> strActualLevelids = new List<int>();
List<int> selectedLevelids = new List<int>();
for (int count = 0; count < inflationRelationship.Count; count++)
{
if (inflationRelationship[count].IsReleatedIndex > 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
&& 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();
}
http://jsfiddle.net/aavUA/19/ – emphaticsunshine
このリンクをクリックすると、問題のあるJSONを返すASP.NETサービスを修正しようとしているのですか。あなたのJavaScriptで悪いJSONを使用しますか? – apiguy
健全なJSONを返すようにaspコードを修正しようとしています.jsは余分な評価をする必要はありません。 – emphaticsunshine