Add a function to output dictionaries to json