How can I map array of objects to required format as below
courses.map do |c| { \'name\' : c.name, \'topic\' : c.topic } end
Its resu