Serialize relationship attributes to JSON