implements the json_writer