covert roles array into object