[英]Need help writing and reading from JSON for a discord bot
我正在使用此示例中的代码: 保存 JSON 文件以便稍后从中获取其他数据
我复制并粘贴了这段代码只是为了测试它并确保它工作正常,当我运行它时,我得到这个错误:
undefined:1
{
^
SyntaxError: Unexpected token in JSON at position 0
at JSON.parse (<anonymous>)
at Object.<anonymous> (/Users/vishnu/Documents/DiscordBot/index.js:5:19)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
我是 node.js 的新手,所以我仍在尝试理解这一点。 任何帮助,将不胜感激
这通常意味着{
符号的数量与}
的数量不匹配
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.