繁体   English   中英

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

[英]JSON.parse() not working in Google Apps Script?

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

代码.gs
 const run = () => { const result = JSON.parse('{"foo": "bar"}'); Logger.log( 'result: %s', result, ); return result; }

抛出:

类型错误:JSON.parse 不是运行时的函数

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

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

评论总结:

确保您没有将JSON重新分配给其他东西。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM