有许多“标准”为“标准”Json Json (Json Json) (Json Json Json) (Json Json) Json Json (Json Json) Json (Json) Json (Json) Json (Json) Json (Json) Json (Json) Json (Json) Json(Json) Json (Json) Json (Json) Json(Json) Json (Json) Json内容类型 :

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

我用哪一种,在哪里?我假设安全和浏览器支持问题是一个因素。

相关:如果JSON被AST API送回来 是什么MIME类型?


当前回答

对于JSON,我使用:

Content-Type: application/json

国际贸易贸易工作组JSON数据交换格式7158提案对此作了说明,第1.2节:JSON的规格.

其他回答

并非所有内容都适合内容类型application/json.

如果您正在使用Ext JS向上传文件提交窗窗窗后,请注意服务器响应由浏览器解析,以创建文档<iframe>.

如果服务器正在使用 JSson 发送返回对象, 那么Content-Type必须设置为text/html以便告诉浏览器将未改变的文字插入文档正文。

见见Ext JS 3.4.0 API文件.

最常见的MIME 类型这是应用程序/json。 这是所有 JSON 内容类型的列表 :

过时类型 :

  • Content-Type: text/javascript - JavaScript 但是,但用于 HTML 属性的旧的因特网探索者版本。
  • Content-Type: text/x-javascript- JavaScript媒体类型,但是,但过时

给杰森:

Content-Type: application/json

用于杰森-普:

Content-Type: application/javascript

JSP JSP,您可以在页面指令中使用此指令:

<%@ page language="java" contentType="application/json; charset=UTF-8"
    pageEncoding="UTF-8"%>

正确无误米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米米JSON 是application/jsonJSP将使用它向客户发送回复。

  • Content-Type: application/json-杰森
  • Content-Type: application/javascript - 杰森-普
  • Content-Type: application/x-javascript - JavaScript
  • Content-Type: text/javascript - JavaScript 但是,但用于 HTML 属性的旧的因特网探索者版本。
  • Content-Type: text/x-javascript- JavaScript媒体类型,但是,但过时
  • Content-Type: text/x-json- 曾经杰森申请/日文正式注册。