application/json
application/x-javascript
text/javascript
text/x-javascript
text/x-json
我用哪一种,在哪里?我假设安全和浏览器支持问题是一个因素。
application/json
application/x-javascript
text/javascript
text/x-javascript
text/x-json
我用哪一种,在哪里?我假设安全和浏览器支持问题是一个因素。
当前回答
其他回答
缩略
application/json
PHP 中保存数组或对象数据的工作非常出色 。
我用这个代码把数据输入JSONGoogle Cloud 储存(GCS)设定了可公开观看:
$context = stream_context_create([
'gs' => [
'acl'=>'public-read',
'Content-Type' => 'application/json',
]
]);
file_put_contents(
"gs://BUCKETNAME/FILENAME.json",
json_encode((object) $array),
false,
$context
);
要返回数据是直线前进的:
$data = json_decode(file_get_contents("gs://BUCKETNAME/FILENAME.json"));
“application/json
”是正确的JSON内容类型。
def ajaxFindSystems = {
def result = Systems.list()
render(contentType:'application/json') {
results {
result.each{sys->
system(id:sys.id, name:sys.name)
}
}
resultset (rows:result.size())
}
}
为补充先前的答复,JSON 链接数据的MIME类型(JSON-LD)以 W3C 计算是:
application/ld+json
类型名称 :应用
子类型名称 :Ld+json 键盘
此外,来自同一来源的:
文件扩展名:
.jsonld
内春春您有一个定义型号 :MediaType.APPLICATION_JSON_VALUE
等于申请/日文.
如果JSON是用垫子垫着的,那它就是application/jsonp
如果JSson没有踏板,那它就会是application/json
.
要同时处理这两种问题,使用“应用/刺杀”是一种良好做法,无需担心是用垫子还是不用垫子。