splitting work between to_json and publisher