JSON_PRETTY_PRINT works on localhost but doesnt work on server

On localhost xamp, it prints fine. But same script, when i uploaded it on server (cpanel hostgator php7) it stays without formatting.

Here is my code, data are same and fine. Chrome and not “View page source”. Php7.3 on hosting, php 8 on localhost, no errors

header('Content-Type: application/json; charset=utf-8');
echo(json_encode($data,JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) );

Heres screenshot on hosting and on localhost

enter image description here