Debug DAX variables using TOJSON and TOCSV

How to use the TOJSON and TOCSV functions to inspect the content of intermediate table variables when debugging a DAX measure.