The issue here is that your "sessions" variable refers to an array and not a session object. What you are doing would have worked perfectly for a single session (of class SessionResume) but for an array you need to do something like the following:
sessions = ended_sessions.where("current_date <= (created_at + interval '12 hours')")
json = JSON.parse(ActiveModel::ArraySerializer.new(sessions).as_json)
json.each do |session|
# additional processing
end
Note that you need to use ActiveModel::ArraySerializer rather than the class specific, single-object serializer.