Set an object property at a given index