I am trying to pretty print a json array, AND un-escape slashes at same time, but don't know how...
I've got:
<pre><?php echo json_encode($data, JSON_PRETTY_PRINT); ?></pre>
or
<pre><?php echo json_encode($data, JSON_UNESCAPED_SLASHES); ?></pre>
working fine on their own, but can't seem to combine them.
Found out how:
<pre><?php echo json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); ?></pre>
Read about the PHP bitwise operators.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With