와 JSON 객체를 읽어보십시오. 다음을 시도했습니다 :내가이 JSON 개체가 jQuery를
var obj = jQuery.parseJSON(json_object); //json object
alert(obj.nodes.items[0].icon); //Uncaught TypeError: Cannot read property 'items' of undefined
와 JSON 객체를 읽어보십시오. 다음을 시도했습니다 :내가이 JSON 개체가 jQuery를
var obj = jQuery.parseJSON(json_object); //json object
alert(obj.nodes.items[0].icon); //Uncaught TypeError: Cannot read property 'items' of undefined
var items;
items = obj.Master.nodes.event.items;
alert(items[0].icon);
items
결과를 배열에
jQuery.parseJSON
가 실패하지 않으면 선도적 인 {와 후행 두}
json_object = '{ "Master": {
//
//
//
} }';
누락로 JSON이 잘못 유의하십시오. 여기 JSON의
JSON은 "마스터"라는 단일 키를 정의합니다. 시도 :
alert(obj.Master.nodes.items[0].icon);
시도하고있다. :'정의되지 않은 속성 0을 읽을 수 없다. ' –
@ free4ride 권리가있다 - 항목이있다. 노드의 이벤트 키 아래에. – mmigdol
console.log(obj.Master.nodes.event.items[0].icon)
체크 구조 : 당신이 당신의 JSON을 노드 상속을
alert(obj.Master.nodes.event.items[0].icon);
을 이해하고 확인하는 데 도움이 될 것입니다 http://jsonviewer.stack.hu/
확인 당신은 유효한 json이있다, 당신은 이것을 시도 할 수있다 : http://www.freeformatter.com/json-formatter.html –