문제가 있습니다. 별도의 파일에 JSON 개체 목록이 있지만 데이터 테이블로 파싱하고 싶습니다. 내가 그들을 구문 분석하려고 할 때마다, 나는 여기에 JSON.parse : 예기치 않은 문자 오류
는 JSON은 (자바 스크립트) 객체의 문자열 표현입니다var myJSONObject = {
"orders" : [{
"orderId" : "K2_001",
"dueDate" : "04/15/2012",
"priority" : 1,
"description" : "ORDER K2_001"
}, {
"orderId" : "K2_002",
"dueDate" : "04/20/2012",
"priority" : 2,
"description" : "ORDER K2_002"
}, {
"orderId" : "K2_003",
"dueDate" : "04/23/2012",
"priority" : 3,
"description" : "ORDER K2_003"
}, {
"orderId" : "K2_004",
"dueDate" : "04/27/2012",
"priority" : 4,
"description" : "ORDER K2_004"
}, {
"orderId" : "K2_005",
"dueDate" : "04/30/2012",
"priority" : 5,
"description" : "ORDER K2_005"
}, {
"orderId" : "K2_006",
"dueDate" : "05/05/2012",
"priority" : 6,
"description" : "ORDER K2_006"
}, {
"orderId" : "K2_007",
"dueDate" : "05/12/2012",
"priority" : 7,
"description" : "ORDER K2_007"
}, {
"orderId" : "K2_008",
"dueDate" : "05/14/2012",
"priority" : 8,
"description" : "ORDER K2_008"
}]
};
var jsonObject2 = Y.JSON.parse(myJSONObject.responseText);
는'myJSONObject'는 * 이미 * 객체가이 구문 분석 할 필요가없는 것입니다. –
JSON이 무엇인지 이해하지 못합니다. 'JSON.parse'는 문자열을 객체로 변환합니다. 이미 개체가 있습니다. –