Updating listener implementation to write out the json to the streams