read and write dict as json files