【发布时间】:2018-07-26 20:52:04
【问题描述】:
我正在使用简单的 Node.js 从有效的 jsonfile 中提取信息(使用 JSLint 检查),但我使用的代码没有返回预期值:
squadJSON = JSON.parse(fs.readFileSync('./squads/squad' + whichSquad + '.json'));
然后它返回:
{ type: 'Buffer', data:
[ 123,
10,
32,
32,
34,
97,
99,
... 548 more items ] }
为什么会发生这种情况?
【问题讨论】:
-
期望值是多少?
-
没有。
JSON.parse永远不会返回缓冲区。
标签: javascript node.js