How to extract the values from different objects?