我有以下json對象數組。json對象的過濾器數組
[{"template":{"title":"title 1"}},{"template":{"title":"title 1"}},{"template":{"title":"title1111"}},{"template":{"title":""}},{"template":{"title":""}},{"template":{"title":"this is the title"}},{"template":{"title":"title232"}},{"template":{"title":"title with msg"}},{"template":{"title":"title with msg"}},{"template":{"title":"title with msg"}},{"template":{"title":"title with msg"}},{"template":{"title":"title with msg"}},{"template":{"title":"title with msg"}},{"template":{"title":"title with msg"}},{"template":{"title":"title with msg"}},{"template":{"title":"title with msg"}},{"template":{"title":"title with msg"}},{"template":{"title":"title with msg"}},{"template":{"title":"this is a title"}},{"template":{"title":"this is a title"}},{"template":{"title":"this is a title"}},{"template":{"title":"some title"}},{"template":{"title":"some title"}},{"template":{"title":"some title"}},{"template":{"title":"some title"}}]
我想這陣能像
[{'title': 'some title'}, {'title': 'some other title'}, ...]
所以基本上我不想讓JS響應裏面的模板屬性。 我是從下面的Rails代碼得到這個
@templates = Template.find_all_by_user_id(current_user.id, :select=>'title', :conditions=>"title is not null")
@templates.to_json
是什麼給了我這個數組JSON對象的
有什麼建議?