【发布时间】:2017-01-15 22:58:09
【问题描述】:
我一直在使用 YouTube A.P.I. 开发一个网站
在 JSON 文件的 description 标记内是换行符 \n
我需要将这些标签转换为 HTML 格式
VideoDescriptions.push(item.snippet.description);
["Example description\nPlease click the link", "Another example description\nMore info"]
编辑:
这个问题不是链接文章的重复,因为:
- 它使用 YouTube API 来检索数据
- 必须从数组而不是字符串进行编辑(如 文章中描述)
- 任何一个问题的答案都可能导致不同的结果和 可能不适用
【问题讨论】:
标签: javascript html json line-breaks youtube-data-api