다음 JSON 데이터를 구문 분석 할 수 있기를 원합니다. 그것은 jsonencode를 사용하여 php 배열로부터 만들어졌습니다. 내가 이해할 수 있도록 아래에 json을 추가했습니다. 글 머리 기호로 json을 표시하고 싶습니다. 연관된 범주 배열과 태그 배열이있는 두 개의 레코드를 보여줍니다. 임 라이브러리를 사용하여 도움을 받으십시오.php json_encode에서 생성 된 JSON 데이터를 구문 분석합니다.
{"0":{"categories":[{"name":"Football Club","slug":"football-club"}],"tags":[{"name":"England","slug":"england"},{"name":"EPL","slug":"epl"},{"name":"Europe","slug":"europe"},{"name":"Champions","slug":"champions"}],"ID":"908","post_author":"78350","post_date":"2010-10-18 10:49:16","post_title":"Liverpool Football Club","post_content":"Content goes here...","post_name":"liverpoolfc","guid":"http://www.liverpoolfc.tv","post_type":"post","comment_count":"0","comment_status":"open","relevance_count":0},"1":{"categories":[{"name":"Football Club","slug":"football-club"}],"tags":[{"name":"England","slug":"england"},{"name":"EPL","slug":"epl"},{"name":"Europe","slug":"europe"},{"name":"Champions","slug":"champions"}],"ID":"907","post_author":"78350","post_date":"2010-10-18 10:49:16","post_title":"Everton Football Club","post_content":"Content goes here","post_name":"evertonfc","guid":"http://www.evertonfc.tv","post_type":"post","comment_count":"0","comment_status":"open","relevance_count":0}}
나는 이것을 분석하여 다음과 같이 표시 할 수 있기를 바랍니다.
- 리버풀 축구 클럽
- 내용은 여기
- 카테고리 간다
- 축구 클럽
- 태그
- 잉글랜드
- EPL
업데이트 : 죄송합니다. 자바 스크립트로 구문 분석해야합니다.
'json_decode()'당신이 PHP 또는 원하는과 서버 측 구문 분석 할 JSON –
을 구문 분석하는 데 사용할 수 있습니다 자바 스크립트를 사용하여 DOM에서 객체를 만드시겠습니까? – dmcnelis
죄송합니다. 자바 스크립트가 클라이언트 측에 있습니다. – madphp