Nov 05 2024

Return JSON response without escaped strings


Are you trying to return something like a URL or file path in a json response and it looks like this?

http:\/\/example.com\/about

It's an easy fix:

1return response()->json([
2 'url' => $url
3], 200, [], JSON_UNESCAPED_SLASHES);