LoginSignup
7
10

More than 5 years have passed since last update.

JSON形式のデータをGASで処理する方法(APIの処理で使うメモ)

Posted at

GASでAPIを叩くための関数(GETの単純な場合)

function API(keyword){
  var APIKEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
  var url ='yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
  var response = UrlFetchApp.fetch(url);
  var o = JSON.parse(response.getContentText());
  return o;
}

JSON形式の処理

JSONの戻り値が下記の場合

{result={area={shop=apple : id=19990}}}

  var o = JSON.parse(response.getContentText());
  o.result.area //{shop=apple : id=19990}
  o.result.area.shop; // apple
7
10
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
7
10