안녕하세요이asp.net에서 JSON에 직렬화 하시겠습니까?
[
{
"Pinky": 1,
"Ponky": "Breakwater Dockk",
},
{
"Pinky": 2,
"Ponky": "Watson Island Dock",
},
등이
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static string Vo_Get(string Action,int ID)
{
Product p= new Product();
DataSet ds= new DataSet();
p.Action = Action;
p.ID= ID;
ds= VoGet_Get(obj);
**string jsonVesselDetails = JsonConvert.SerializeObject(ds, Formatting.None);
return jsonVesselDetails;**
}
여기 스피 점점 내 결과처럼 내의 WebMethod을 가지고 있지만 내가 시도 할 때 사용하는 전화
asp.net
에 firsttime에 대한 JSON을 사용하고 있습니다 Ajax 및 결과 테이블에 바인드하려고하면 unexpexted Token U를 테이블에 추가합니다. result.data로 바인딩하려고하면 O를 보냅니다.GetVessels(data.d);
즉 패스를 :마지막으로 내가
이내 Ajax 호출이
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Voyage.aspx/Vo_Get",
data: "{'Action':'Get','ID':'68'}",
dataType: "json",
success: function (data) {
try {
alert("getdata! success");
Get(data);
} catch (ex) {
alert(ex);
}
},
error: function (msg) {
alert("err: " + error);
}
});
및
에 DateFormathandling을 지정하려고 불을 지르고에서 응답을 볼 수 날짜 필드로 구성되어있는 경우
갱신
,이 발생할 수 있습니다 d와 같은 것. Coz, asp.net jsonp (JSON with Padding) 보안 목적으로 "d"가있는 json 결과를 –