PHP Tutorial: How to Remove (escape) Forward Slashes When Using json_encode()

You only need to use the JSON_UNESCAPED_SLASHES flag:

From PHP.net → http://php.net/manual/en/json.constants.php

JSON_UNESCAPED_SLASHES (integer)
Don’t escape /. Available since PHP 5.4.0.

Example Demo → https://eval.in/459863

Example Output:

[/crayon]

Was this blog post helpful for you?

Support my blog and donate!

My blog is open to the public and will always be freely available. With your donation, we can help others learn, together.

Donate in Bitcoin:

13PtvsxGbkbUDAtMzxk1wPeWEECx6jKM8f