Fixed bug that prevented JSON files from containing the DNS records

When "--json" was specified as the only output option, this output file would not contain the records that were found. This was due to a conditional statement that checked whether there was an output file was to be created (csv, xml), but JSON was not checked in those statements. 

I've included the JSON output in this check, fixing the bug. Furthermore, I've created a variable output_needed, that can be re-used every time this kind of check is needed (instead of checking every output variable every time).