entity scrubbing, return JSON by default, debug flag for console testing