2012-04-26 8 views
3

私はGoogleからの次の応答を取得:このフォーマットは何と呼ばれているGoogle BooksのAPIデータをPHP配列として使用していますか?

{ 
"kind": "books#volumes", 
"totalItems": 1, 
"items": [ 
    { 
    "kind": "books#volume", 
    "id": "t9S82uKGp8IC", 
    "etag": "rn9INXAtx88", 
    "selfLink": "https://www.googleapis.com/books/v1/volumes/t9S82uKGp8IC", 
    "volumeInfo": { 
    "title": "Classic Swedish Interiors", 
    "authors": [ 
    "Lars Sjöberg", 
    "Ingalill Snitt" 
    ], 
    "publisher": "Frances Lincoln Ltd", 
    "publishedDate": "2010-09-07", 
    "description": "Lars Sjöberg has made it his life's work to understand and   preserve the Swedish manor houses of the 17th and 18th centuries. Here, exquisitely photographed by Ingalill Snitt, are the eight houses (and one church) that he has acquired over more than 40 years. The book focuses on Sjöberg's first, most complex project: the manor of Regnaholm. Unoccupied for about 40 years when Sjöberg arrived in 1966, it allowed him to experiment with interior decoration and refurnishing, copying old furniture, reweaving, and reprinting old fabric patterns. His other projects include Ekensberg, a three-story Italianate villa near Lake Mälaren, built in 1788-90, and Salaholm in Västergötland with a garden laid out in the first half of the 17th century. Odenslunda, a small manor from the 1770s with a panelled exterior and a säteritak or manor-house roof, is his family home, while Sörby, a scaled-down early 17th-century manor house, was reproduced in its entirety for an exhibition in Stockholm. Full of insight and inspiration, this is a deeply personal summary of everything Lars Sjöberg has learned in his years of working and living with classic Swedish interiors.", 
"industryIdentifiers": [ 
{ 
    "type": "ISBN_10", 
    "identifier": "0711230889" 
}, 
{ 
    "type": "ISBN_13", 
    "identifier": "9780711230880" 
} 
], 
"pageCount": 208, 
"printType": "BOOK", 
"categories": [ 
"Architecture" 
], 
"contentVersion": "preview-1.0.0", 
"imageLinks": { 
"smallThumbnail": "http://bks8.books.google.com/books?id=t9S82uKGp8IC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api", 
"thumbnail": "http://bks8.books.google.com/books?id=t9S82uKGp8IC&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api" 
}, 
"language": "en", 
"previewLink": "http://books.google.com/books?id=t9S82uKGp8IC&printsec=frontcover&dq=isbn:9780711230880&cd=1&source=gbs_api", 
"infoLink": "http://books.google.com/books?id=t9S82uKGp8IC&dq=isbn:9780711230880&source=gbs_api", 
"canonicalVolumeLink": "http://books.google.com/books/about/Classic_Swedish_Interiors.html?id=t9S82uKGp8IC" 
    }, 
    "saleInfo": { 
    "country": "ZA", 
    "saleability": "NOT_FOR_SALE", 
    "isEbook": false 
    }, 
    "accessInfo": { 
    "country": "ZA", 
    "viewability": "PARTIAL", 
    "embeddable": true, 
    "publicDomain": false, 
    "textToSpeechPermission": "ALLOWED_FOR_ACCESSIBILITY", 
    "epub": { 
    "isAvailable": false 
    }, 
    "pdf": { 
     "isAvailable": true, 
     "acsTokenLink": "http://books.google.com/books/download /Classic_Swedish_Interiors-sample-pdf.acsm?id=t9S82uKGp8IC&format=pdf&output=acs4_fulfillment_token&dl_type=sample&source=gbs_api" 
     }, 
     "webReaderLink": "http://books.google.com/books/reader?id=t9S82uKGp8IC& printsec=frontcover&output=reader&source=gbs_api", 
     "accessViewStatus": "SAMPLE" 
     }, 
     "searchInfo": { 
     "textSnippet": "Full of insight and inspiration, this is a deeply personal summary of everything Lars Sjöberg has learned in his years of working and living with classic Swedish interiors." 
     } 
     } 
    ] 
  1. を? (XMLまたはJSONではありません)
  2. このテキストをPHP配列に変換するにはどうすればよいですか?
+0

この回答を生成するために使用したURLは何ですか?ありがとう。 – Chan

答えて

4

これはJSONです。 json_decode()を使用してPHP連想配列に変換できます。

$books = json_decode($your_json_data, true); 
print_r($books); 
+0

$ books = json_decode($ your_json_data、true); PHP配列を必要としない場合はオブジェクト – sbczk

+0

ああ。改正された。 – Nadh

関連する問題