什么是正确的JSON内容类型?

霸气de小男生 提交于 2020-03-22 22:21:35

3 月,跳不动了?>>>

问题:

I've been messing around with JSON for some time, just pushing it out as text and it hasn't hurt anybody (that I know of), but I'd like to start doing things properly. 我一直在弄乱JSON一段时间,只是将其作为文本推出,并没有伤害任何人(据我所知),但是我想正确地做事。

I have seen so many purported "standards" for the JSON content type: 我见过这么多的所谓的“标准”为JSON内容类型:

application/json
application/x-javascript
text/javascript
text/x-javascript
text/x-json

But which one is correct, or best? 但是哪一个是正确的,还是最好的? I gather that there are security and browser support issues varying between them. 我发现在它们之间存在安全性和浏览器支持问题。

I know there's a similar question, What MIME type if JSON is being returned by a REST API? 我知道有一个类似的问题, 如果REST API返回JSON,则为哪种MIME类型? , but I'd like a slightly more targeted answer. ,但我想要一个更有针对性的答案。


解决方案:

参考一: https://stackoom.com/question/20Ii/什么是正确的JSON内容类型
参考二: https://oldbug.net/q/20Ii/What-is-the-correct-JSON-content-type
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!