refactored to_json function