我有一个需要以下输出的脚本:
[{
"id": "288",
"title": "Titanic",
"year": "1997",
"rating": "7.7",
"genre": "drama, romance",
"od": "0"
}, {
"id": "131",
"title": "The Bourne Identity",
"year": "2002",
"rating": "7.9",
"genre": "action, mystery, thriller",
"od": "1"
}]
这看起来不像格式良好的 json,就像我这样做时一样:
return new JsonResponse(array(
"id" => 288,
"title" => "Titanic",
"year" => "1997",
....
));
我得到这个:
{
"id": 288,
"title": "Titanic",
"year": "1997"
....
}
我正在使用的插件是this,它甚至还有一个$.getJson
Function?!?
我将如何更改输出格式?