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 서비스를 수정하려고합니까, 또는 어떻게 해결할 수 있습니까? 자바 스크립트에서 잘못된 JSON을 사용 하시겠습니까? – apiguy
건강한 JSON을 반환하고 js가 추가 평가를하지 않아도되도록 asp 코드를 수정하려고합니다. – emphaticsunshine