Adding json formating and learning that foreign key means one to many relationship