0
0

More than 3 years have passed since last update.

PHP/json文字列をデコードする

Posted at

json_decode関数を使う。

$object = json_decode($json_string);
// 第二引数をtrueにすると連想配列になる。
$array = json_decode($json_string, true);

例:

$request = file_get_contents("https://www.googleapis.com/books/v1/volumes?q=search+%E6%8A%80%E8%A1%93&maxResults=40");
$json = json_decode($request, true);

var_dump($json['kind']); // string(13) "books#volumes"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0