【发布时间】:2020-11-06 12:39:14
【问题描述】:
我对 node.js 相当陌生,我想知道如何(或者即使)我可以读取和写入 JSON 文件。我正在尝试创建一个可访问的惩罚历史。 理想情况下,我希望能够按照以下方式创建一些东西:
{
"punishments": {
"users": {
"<example user who has a punishment history>": {
"punishment-1567346": {
"punishment-id": "1567346",
"punishment-type": "mute",
"punishment-reason": "<reason>"
},
"punishment-1567347": {
"punishment-id": "1567347",
"punishment-type": "ban",
"punishment-reason": "<reason>"
}
}
}
}
}
然后我就有办法访问格式化的惩罚历史记录。我真的不知道从哪里开始。
【问题讨论】:
-
@thanhdx - 错误的上下文 - 不是来自浏览器,来自 NodeJS
-
@RandyCasburn 是的,我刚刚收回了旗帜。对不起。
标签: javascript json read-write