node.js - Nodejs创建具有多个值的字典错误
问题描述
我正在尝试为经过验证的地址创建字典。但我收到一个错误。我该如何解决?
语法错误:意外的标记“{”
const Addresses = {
{
"0x0000000000000000000000000000000000000000": "BURN",
"Verified": "Yes"
"Type": "Address"
},
{
"0x1010101010101010101010101010101010101010": "BURN",
"Verified": "No"
"Type": "Address"
}
}
解决方案
您需要将变量类型从 json 更新为 object 并添加逗号。像这样。
const Addresses = [
{
"0x0000000000000000000000000000000000000000": "BURN",
"Verified": "Yes",
"Type": "Address"
},
{
"0x1010101010101010101010101010101010101010": "BURN",
"Verified": "No",
"Type": "Address"
}
]
{ ... } => [ ... ]
... : "Yes",
... : "No",
推荐阅读
- node.js - 将 Node.js 页面部署到 AWS Elastic Beanstalk 后出现“hell.php”错误和“502 Bad Gateway”错误
- c# - ASP.NET Core 2.1 - 脚手架不生成任何文件
- function - 事件场景内的电晕功能位置
- r - 在 R 中使用聚合时如何保留其他列?
- django - 使用 Gunicorn 和 Nginx 在一个 Droplet 上运行两个 Django 项目
- r - 使用 mutate_at 缩短多个 dplyr 变异?
- php - 喜欢 jQuery 求和值
- javascript - 为什么我不能将图表添加到动态插入的 svg 元素?
- r - R,ImageMagick:如何在动画中的每个循环后添加延迟
- c# - 如何根据访问级别显示菜单选项?