簡體   English   中英

需要幫助從 JSON 讀寫 discord 機器人

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM