if @sub_entries.is_a? Array json.array! @sub_entries do |entry| json.partial! 'repositories/simple_entry', locals: { entry: entry } end else json.partial! 'repositories/simple_entry', locals: { entry: @sub_entries } end