问题:
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
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/3208436