code for array of object