Home → JSON URL Encode Decode
URL encoding converts JSON into a format safe for use in URLs.
URL encoding converts JSON into a format safe for use in URLs. This tool runs entirely in your browser — no data is ever sent to a server. Free to use, no account required.
URL encoding (percent-encoding) makes JSON safe to include in a URL by replacing special characters with their percent-encoded equivalents.
JSON uses characters that have reserved meaning in URLs: { and } delimit objects, [ and ] delimit arrays, : separates keys and values, " wraps strings. Without encoding, these characters break URL parsing.
The most commonly encoded characters are: { → %7B, } → %7D, [ → %5B, ] → %5D, " → %22, : → %3A, , → %2C, and space → %20. The encoded string is longer but unambiguous in any URL context.
URL-encoded JSON appears in several web development scenarios, particularly with GET request parameters and debugging.
Some APIs accept complex filter or options objects as query string parameters. For example: GET /items?filter=%7B%22status%22%3A%22active%22%7D. This is valid for small JSON objects in GET requests.
Browser devtools, server logs, and proxy tools often show encoded URLs. Decoding the parameters reveals the original JSON structure, which is essential for debugging API integrations.
URL-encoding JSON is necessary when passing JSON data in query parameters, cookies, or URL fragments. It replaces special characters with percent-encoded equivalents.
// Original JSON
{"name": "Alice Johnson", "city": "New York", "active": true}
// URL Encoded
%7B%22name%22%3A%22Alice%20Johnson%22%2C%22city%22%3A%22New%20York%22%2C%22active%22%3Atrue%7D
// As query parameter
https://api.example.com/search?filter=%7B%22name%22%3A%22Alice%22%7D
// JavaScript
const json = {"name": "Alice", "city": "New York"};
const encoded = encodeURIComponent(JSON.stringify(json));
const decoded = JSON.parse(decodeURIComponent(encoded));
| Character | Encoded |
|---|---|
| { | %7B |
| } | %7D |
| " | %22 |
| : | %3A |
| , | %2C |
| %20 or + | |
| [ | %5B |
| ] | %5D |
| / | %2F |
| + | %2B |
| = | %3D |
| & | %26 |
| Method | Behavior | Use Case |
|---|---|---|
| encodeURIComponent() | Encodes everything except A-Z a-z 0-9 - _ . ! ~ * ' ( ) | Use for JSON in query params |
| encodeURI() | Preserves : / ? # [ ] @ ! $ & ' ( ) * + , ; = | Use for full URLs only |
| Base64 encoding | Encodes to A-Z a-z 0-9 + / = characters | Alternative for JSON in URLs |
| URL-safe Base64 | Replaces + with - and / with _ | Best for JSON in JWTs and URLs |
Explore more tools: All JSON Tools | Validator | Pretty Print | JSON Diff
Percent-encoding converts special characters in JSON into safe sequences. Every character that is not a letter, digit, or one of -_.!~*'() is replaced with %XX where XX is the hexadecimal ASCII code for that character.
// These characters must be encoded in URLs:
// { } [ ] : " , space and more
const jsonObj = {"name": "Alice Smith", "role": "admin"};
const jsonStr = JSON.stringify(jsonObj);
// '{"name":"Alice Smith","role":"admin"}'
const encoded = encodeURIComponent(jsonStr);
// '%7B%22name%22%3A%22Alice%20Smith%22%2C%22role%22%3A%22admin%22%7D'
// Use in a URL
const url = `https://api.example.com/search?filter=${encoded}`;
// Decode on the server
const decoded = decodeURIComponent(encodedParam);
const data = JSON.parse(decoded);
| Aspect | URL Encode | Base64 Encode |
|---|---|---|
| Output size | ~30% larger | ~33% larger |
| Human readable | Partially (keys recognizable) | No |
| URL safe | Yes | Partially (use URL-safe variant) |
| Use case | URL query params | HTTP headers, data URIs, cookies |
| Decode complexity | decodeURIComponent | atob / Buffer.from |
| Reversible | Yes | Yes |
| Handles binary | No | Yes |
| Location | Method | Example |
|---|---|---|
| Query string | URL encode the JSON | ?data=%7B%22id%22%3A1%7D |
| Request body | Set Content-Type: application/json | Raw JSON body |
| HTTP header | Base64 encode | X-Data: eyJpZCI6MX0= |
| Cookie | URL encode or Base64 | data=%7B%22id%22%3A1%7D |