Node.JS中的JSON ForEach [重复]

问题描述 投票:0回答:2
我已经使用Node.JS编写了一个网址缩短器,并保存在json-data中。现在,我正在为团队编写一个Web仪表板以管理URL。我喜欢使用forEach,因为我可以轻松地使用它为每个条目向我的html网站添加代码。我的问题:我有这样的json数据:

{ "support": { "url": "https://this-is-the-url.end", "author": "Name of the Author" }, "invite": { "url": "https://an-other-url.end", "author": "Name of the Author" }, . . . }

而且我不知道如何拆分它,所以我可以使用

Object.forEach(json => { var author = json.author var url = json.url *add code to html code* })

我已经在Stackoverflow上进行了搜索,但是我找不到任何东西。有人可以帮我吗?
javascript json foreach
2个回答
0
投票
喜欢吗?

0
投票
可能是这样:
© www.soinside.com 2019 - 2024. All rights reserved.