Why JSON URLs Contain Backslashes (and How to Fix Them)
June 15, 2026 ยท 4 min read
You call an API, open the response, and every link looks broken:
"image": "https:\/\/cdn.example.com\/photos\/cat.jpg"
Those backslashes look wrong, but the URL is perfectly fine. Here's what's actually happening.
The forward slash is being escaped
In JSON, the forward slash / is allowed to be written as \/. Both mean
exactly the same thing. The JSON specification permits escaping / so that strings
containing </script> can be safely embedded inside HTML without prematurely
closing a script tag. Many server frameworks (PHP's json_encode, for example) do this
by default.
So the URL isn't broken?
Correct. When a JSON parser reads "https:\/\/cdn.example.com", it decodes it back to
https://cdn.example.com. The escaping only exists in the raw text โ once parsed, the
value is a normal URL. If you ever paste the raw string somewhere that doesn't run it
through a JSON parser, that's when the stray backslashes cause trouble.
How to clean it
The fastest fix is to unescape the slashes before you copy the URL out:
- Open API URL Kit.
- Paste the API response into the JSON tab.
- Click Clean URLs to turn every
\/back into/. - Or click Extract URLs to pull out a clean, deduplicated list automatically.
That's it โ no regex, no code, no copy-pasting into a console. Everything runs locally in your browser, so your data never leaves your machine.