0
0

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 3 years have passed since last update.

JSONのサイズ取得の違い

Last updated at Posted at 2020-07-19
test.gs
function test(){
  var jsonObject = {
    "aaa": [ {"a":1, "b":2, "c":3},{"a":4, "b":5, "c":6} ],
    "bbb": 333,
    "ccc": 444
  };

  Logger.log(jsonObject.length);
  Logger.log(jsonObject.aaa.length);
  Logger.log(Object.keys(jsonObject).length);
  Logger.log(Object.keys(jsonObject.aaa).length);
}
ログ
[20-07-19 22:34:03:645 JST] null
[20-07-19 22:34:03:648 JST] 2.0
[20-07-19 22:34:03:650 JST] 3.0
[20-07-19 22:34:03:652 JST] 2.0
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?