URL Encode JSON

Encode JSON for safe inclusion in URLs.

Input (JSON)
Options
Encoding Method
Hexadecimal Letter Case
Output (URL-encoded JSON)

What It Does

The URL Encode JSON tool converts your JSON data into a URL-safe format using percent-encoding, making it possible to safely transmit structured data through URLs, query strings, and HTTP GET requests. When JSON is included directly in a URL, characters like curly braces, square brackets, colons, quotes, and spaces break the URL structure and cause errors in browsers, servers, and APIs. Percent-encoding replaces these characters with their hexadecimal equivalents prefixed by a percent sign — for example, a space becomes %20, a curly brace becomes %7B, and a colon becomes %3A. This tool handles that transformation instantly and accurately, preserving the full structure of your JSON including nested objects, arrays, booleans, numbers, and null values. Whether you're a developer building shareable links with embedded application state, a QA engineer crafting test URLs, or a data analyst generating parameterized report links, this tool removes the friction from a task that's easy to get wrong manually. Encoding JSON by hand is error-prone and tedious — a single missed character can break an entire URL. This tool guarantees complete, standards-compliant encoding every time so you can focus on your actual work.

How It Works

The URL Encode JSON applies its selected transformation logic to your input and produces output based on the options you choose.

It applies a fixed set of transformation rules to your input, so the output is stable and easy to verify.

All processing happens in your browser, so your input stays on your device during the transformation.

Common Use Cases

  • Passing JSON configuration objects as query parameters in REST API GET requests without breaking the URL structure.
  • Embedding application state (such as filters, settings, or view preferences) in shareable URLs so users can bookmark or share exact views.
  • Constructing deep-link URLs for mobile apps that accept structured JSON parameters in their URI schemes.
  • Building webhook callback URLs that include JSON payloads encoded within the query string for third-party integrations.
  • Creating parameterized report or dashboard links in BI tools that read JSON-encoded filters from the URL.
  • Preparing JSON data for inclusion in HTML href attributes or anchor tags where raw JSON would break the markup.
  • Testing and debugging API endpoints by manually crafting GET requests with complex JSON query parameters directly in the browser address bar.

How to Use

  1. Paste or type your JSON object or array into the input field — ensure it is valid JSON with proper key-value syntax, correct bracket matching, and quoted string keys.
  2. The tool automatically detects and percent-encodes every character that is not URL-safe, including braces, brackets, colons, quotes, commas, spaces, and forward slashes.
  3. Review the encoded output in the result field to confirm it looks complete — the encoded string should start with %7B for objects or %5B for arrays.
  4. Click the copy button to copy the encoded string to your clipboard, then paste it directly into your URL query string, API request, or link builder.
  5. On the receiving end, pass the encoded value through a URL-decode function in your programming language of choice before parsing it as JSON — for example, decodeURIComponent() in JavaScript or urllib.parse.unquote() in Python.

Features

  • Full percent-encoding of all special characters including braces, brackets, colons, commas, quotes, spaces, and forward slashes that would otherwise break URL syntax.
  • Preserves complete JSON structure integrity — nested objects, arrays, numbers, booleans, and null values all survive the encoding process intact.
  • Instant real-time encoding as you type or paste, with no submit button required, so you can quickly iterate on your JSON payload.
  • One-click copy to clipboard for the encoded output, making it fast to transfer the result into your URL, API client, or code.
  • Handles arbitrarily complex JSON including deeply nested structures and large arrays without truncation or data loss.
  • Standards-compliant RFC 3986 percent-encoding that is recognized and correctly decoded by all major browsers, server frameworks, and HTTP libraries.
  • No data is sent to any server — all encoding happens client-side in your browser, keeping sensitive JSON payloads private.

Examples

Below is a representative input and output so you can see the transformation clearly.

Input
hello world?
Output
hello%20world%3F

Edge Cases

  • Very large inputs may take a few seconds to process in the browser. If performance slows, split the input into smaller batches.
  • Mixed formatting (tabs, line breaks, or inconsistent delimiters) can affect output. Normalize spacing first if needed.
  • URL Encode JSON follows the selected options strictly. If the output looks unexpected, re-check option settings and input format.

Troubleshooting

  • Output looks unchanged: confirm the input contains the pattern this tool modifies and that the correct options are selected.
  • Output differs from a previous run: confirm that the input and every option match, because deterministic tools should repeat when the settings are identical.
  • Unexpected characters: check for hidden whitespace or encoding issues in the input and try normalizing first.
  • Slow processing: reduce input size or try a modern browser with more available memory.

Tips

Always validate your JSON before encoding it — invalid JSON will encode fine but will fail to parse correctly on the receiving end, leading to confusing errors. Use a JSON validator first if you're not certain your input is well-formed. When embedding the encoded value in a URL, place it after an equals sign in a query parameter (e.g., ?data=%7B%22key%22%3A%22value%22%7D) and make sure the entire value is encoded as a single unit. On the receiving end, always URL-decode before JSON-parsing — the order matters. If your use case allows it, consider using POST requests with a JSON body instead of GET with encoded query parameters, as this avoids URL length limits (typically 2,048 characters in older browsers) and keeps payloads cleaner.

URL encoding, formally defined in RFC 3986, is the process of converting characters that have special meaning in a URL into a safe representation using percent-followed-by-hexadecimal sequences. Every URL is divided into components — scheme, host, path, query string, and fragment — each of which has its own set of characters that carry structural meaning. The query string, delimited by a ? and made up of key=value pairs separated by &, is where most JSON embedding happens, and it is also where raw JSON causes the most breakage. Characters like { } [ ] : , " and spaces are either reserved for URL structure or simply not allowed in URLs at all. Without encoding, a browser or server parser will misread the JSON as part of the URL structure rather than as a data value. Percent-encoding solves this by expressing every problematic byte as %XX, where XX is the byte's two-digit hexadecimal value in UTF-8. For example, the left curly brace { has ASCII code 123, which is 7B in hex, so it becomes %7B. A double quote " (ASCII 34, hex 22) becomes %22. This transformation is completely reversible — the receiving application simply replaces each %XX sequence with the original character before parsing the data. Why embed JSON in URLs at all? The primary reason is stateless sharing. HTTP GET requests are inherently stateless and cacheable, which makes them ideal for shareable, bookmarkable links. If you want a URL that encodes not just a simple ID but a complex set of filters, preferences, or configuration options, JSON is a natural container for that structured data. Embedding it as a URL-encoded query parameter means the entire application state lives in the link — paste it in a browser and the page loads with exactly the right state restored. A common comparison is JSON in GET vs. POST. POST requests carry a body, which avoids URL-length limitations and doesn't require encoding the JSON for URL safety. However, POST requests aren't bookmarkable and aren't cached by browsers or CDNs. For read-only operations where shareability matters, GET with a URL-encoded JSON parameter is often the right choice. For write operations or large payloads, POST with a JSON body is cleaner and more appropriate. Another related technique is Base64-encoding JSON before including it in a URL. Base64 produces a compact string of alphanumeric characters plus + / = that is somewhat shorter than percent-encoding, but those three characters still need to be percent-encoded for strict URL safety (using the URL-safe Base64 variant with - and _ instead). Base64 adds a decoding step on the receiving end and makes the payload completely opaque, whereas percent-encoded JSON is human-readable with a glance. For debugging and transparency, percent-encoding is often preferred. For developers, it's worth knowing that JavaScript's encodeURIComponent() function performs percent-encoding suitable for query parameter values, while encodeURI() does not encode characters like : / ? # which are valid in full URLs. When embedding JSON as a parameter value, always use encodeURIComponent() — or this tool — rather than encodeURI(), which will leave colons and other problematic characters unencoded.

Frequently Asked Questions

What is URL encoding and why does JSON need it?

URL encoding, also called percent-encoding, converts characters that have special meaning in a URL — like { } [ ] : " and spaces — into safe %XX sequences where XX is the hexadecimal byte value. JSON uses many of these special characters as part of its syntax, so including raw JSON in a URL query string causes parsers to misread the JSON as part of the URL structure. URL encoding transforms the JSON into a string of characters that are safe to include anywhere in a URL without ambiguity.

How do I decode URL-encoded JSON on the receiving end?

In JavaScript, use decodeURIComponent(encodedString) to reverse the percent-encoding, then pass the result to JSON.parse() to get a usable object. In Python, use urllib.parse.unquote(encoded_string) before passing to json.loads(). In PHP, urldecode() handles the decoding. The key rule is always decode first, then parse — attempting to JSON-parse a percent-encoded string will fail because the percent signs and hex codes are not valid JSON syntax.

Is there a limit to how much JSON I can pass in a URL?

Yes — browsers and servers impose URL length limits, typically around 2,048 characters in older browsers (Internet Explorer) and up to 8,000+ characters in modern browsers and most web servers, though this varies by server configuration. Percent-encoding inflates the size of a JSON payload significantly because each special character expands from 1 byte to 3 characters (%XX). For large or complex JSON objects, this limit can be hit quickly. If your encoded JSON regularly exceeds a few hundred characters, consider switching to a POST request with a JSON body to avoid the constraint entirely.

What is the difference between URL encoding and Base64 encoding JSON?

Both approaches make JSON safe for transport in contexts that don't support raw JSON, but they work differently. URL encoding replaces each unsafe character with its %XX equivalent, keeping the result human-readable and slightly verbose. Base64 encoding converts the entire JSON string into a compact stream of alphanumeric characters that is about 33% larger than the original but opaque. For URL query parameters, URL encoding is more transparent and easier to debug; Base64 adds a layer of obscurity and requires an additional decode step. Neither is encryption — both are fully reversible encoding schemes.

Does this tool send my JSON data to a server?

No — all encoding is performed entirely in your browser using JavaScript. Your JSON data never leaves your device and is never transmitted to any server. This makes the tool safe to use with sensitive configuration data, API keys in JSON structures, or any private payload you need to encode. You can also use it offline once the page has loaded.

Why does my encoded JSON look so much longer than the original?

Percent-encoding expands every special character from 1 character to 3 characters (a percent sign plus two hex digits). JSON is dense with special characters — nearly every { } [ ] : , " space and newline gets expanded. A compact JSON object that's 50 characters can easily become 150 characters when encoded. This is normal and expected behavior. The encoded string decodes back to the exact original JSON without any data loss.