more refactoring/modularization of JSON data exporter