Convert data into nested object