错误:JSON.parse:在JSON数据的第1行第21980行的JSON数据之后出现意外的非空白字符

时间:2016-10-18 11:38:38

标签: angularjs json web-services

我使用angularjs http Post调用从ASMX服务获取信息。

我按照以下方式调用ASMX服务:

$http({
                method: 'POST',
                url: 'FileService.asmx/GetSearchResults',
                data: JSON.stringify({ fso: fileSearchOptions }),
                contentType: "application/json; charset=utf-8",
                dataType: "json"
            })
           .then(successCallBack, errorCallBack);

回复如下:

List<File> filesList = new List<File>();

            if (response != null && response.FileSearchResults != null)
            {
                foreach (var f in response.FileSearchResults)
                {
                    File file = new File();
                    file.FileID = f.FileID;
                    file.FileNumber = f.FileNum;
                    file.OpenDate = f.OpenDate != null ? f.OpenDate.Value.ToShortDateString() : string.Empty;
                    file.CreationDate = f.CreationDate != null ? f.CreationDate.Value.ToShortDateString() : string.Empty;
                    file.RegionName = f.RegionName;
                    file.FileStatus = f.StatusCD;
                    file.Address = f.Address;

                    filesList.Add(file);
                }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
            Context.Response.Write(js.Serialize(filesList));

我无法确定我在哪里尝试解析已经解析过的数据。如果我错了,请纠正我。

错误我得到的是:

错误:JSON.parse:在JSON数据的第1行第21980行的JSON数据之后出现意外的非空白字符

提前致谢!!!

0 个答案:

没有答案