Refactored JSON conversion into functions that accept a Communication instance or a Communication filename.