Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js discord.js如何从json文件中获取desc值_Node.js_Json_Discord.js - Fatal编程技术网

Node.js discord.js如何从json文件中获取desc值

Node.js discord.js如何从json文件中获取desc值,node.js,json,discord.js,Node.js,Json,Discord.js,当我运行console.log(data[key].use)命令时,我在数据中加载了json文件,我得到了一个响应 [ { name: 'Devour', desc: 'Consumes a target tree to gain 7 health regeneration for 16 seconds. Consuming a ward or Ironwood Tree doubles the heal amount.\n\nComes with 3 charges. C

当我运行
console.log(data[key].use)命令时,我在数据中加载了json文件,我得到了一个响应

[ { name: 'Devour',
    desc:
     'Consumes a target tree to gain 7 health regeneration for 16 seconds. Consuming a ward or Ironwood Tree doubles the heal amount.\n\nComes with 3 charges.  
Can be used on an allied hero to give them one Tango.\n\nTree Range: %abilitycastrange%\nWard Range: 450' } ]
如何获取
desc


我尝试了
数据[key]。使用.desc
但给了我
未定义的

您可以尝试
数据[key]。使用[0]。desc
?我想你得到的结果是在某些地方出现了一个新问题,它的
主动
部分
被动
甚至
切换
而不是
使用
我能做什么?如果我这样做| |它给了我
[0]无法读取0的属性
更别说得到它了