write objects to file using json