Javascript 有可能让youtube在JSON中嵌入代码吗?

Javascript 有可能让youtube在JSON中嵌入代码吗?,javascript,json,Javascript,Json,我可以在我的JSON中嵌入youtube代码吗?一旦JSON的内容被使用,我可以将其作为视频显示吗 [{ "title": "New World Sound & Thomas Newson - Flute (Original Mix)", "embed": "<iframe width=" 560 " height=" 315 " src=" https: //www.youtube.com/embed/e-U1lj57pv8" frame

我可以在我的JSON中嵌入youtube代码吗?一旦JSON的内容被使用,我可以将其作为视频显示吗

[{

    "title": "New World Sound & Thomas Newson - Flute (Original Mix)",
    "embed": "<iframe width="
    560 " height="
    315 " src="
    https: //www.youtube.com/embed/e-U1lj57pv8" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>"

}]
[{
“标题”:“新世界之声&托马斯·纽森-长笛(原创混音)”,
“嵌入”:”
}]

由于JSON是用于数据的,所以最好像

{
  "name": "Beautiful cats",
  "keywords": ["cats", "cat", "beautiful", "funny"],
  "contentUrl": "https://www.youtube.com/embed/e-U1lj57pv8" 
}
当客户端读取时,它可以选择在
iframe
中显示contentUrl


考虑一下不仅在浏览器场景中使用JSON:那么iframe将非常无用

Youtube嵌入代码可以进入JSON,但这不是有效的JSON。新行需要转义。