JSON.parse() 在 Google Apps 脚本中不起作用?

JS 本机方法JSON.parse()似乎在 Google Apps 脚本中出现故障。


代码.gs

const run = () => {

  const result = JSON.parse('{"foo": "bar"}');

  Logger.log( 'result: %s', result, );

  return result;

}

抛出:


TypeError:JSON.parse 不是运行时的函数


这是 Google Apps 脚本的错误吗?还是我做错了什么?


编辑:我尝试时也遇到类似的错误JSON.stringify({foo: "bar"})


慕田峪7331174
浏览 104回答 1
1回答

拉丁的传说

评论摘要:确保您没有重新分配JSON给其他东西。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript