0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JSで多階層のJSONを扱う時の備忘録

Posted at

経緯

 GAS使うことになった

function test() {
  var testJson = '{"replyToken":"897aa08fd48247f5aa2aa99999999999", "source":{"type":"user", "userId":"U911cc758e62b359634cd299999999999"}, "type":"message", "message":{"id":"6906513233888", "text":"なまなまか", "type":"text"}, "timestamp":"1.50917625936E12"}';
  var response = JSON.parse(testJson);
  var source = response.source;
  var s_source     = JSON.stringify(source);
  var sourceArr     = JSON.parse(s_source);
  var userId        = source.userId;
  Logger.log(source);
  Logger.log(s_source);
  Logger.log(sourceArr);
  Logger.log(userId);

}

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?