Improved var_dump_json to allow forcing of echo, or defaulting to detecting on cli mode