Writing out json file