JSON URL Encoder
URL-encode JSON strings for safe use in query parameters and links
JSON Input
URL-Encoded Output
What Is JSON URL Encoding?
URL encoding (also called percent-encoding) converts characters that are not allowed in a URL into a safe %XX hexadecimal sequence. When you need to embed a JSON string inside a URL — for example as a query parameter — characters like {, }, ", spaces, and brackets must be encoded or the URL will break.
This tool applies JavaScript's encodeURIComponent() to your JSON string. The RFC 3986 URI standard specifies which characters are safe in a URL and which must be percent-encoded. The reverse operation — decoding — is handled by our JSON URL Decoder.
How to URL-Encode JSON
Follow these steps to percent-encode your JSON string.
Paste or enter your JSON
Type or paste your JSON into the input panel. You can also click Sample to load an example. The JSON does not need to be valid — the tool will encode any string.
Instant encoding
The encoded output appears automatically in the right panel. Every unsafe character is replaced with its %XX equivalent — for example { becomes %7B and " becomes %22.
Copy the result
Click Copy to copy the URL-encoded string to your clipboard. You can then paste it directly into a URL query parameter, a fetch call, or any HTTP request.
Common Use Cases
Query Parameter Embedding
Many REST APIs accept JSON objects as query parameters (e.g., ?filter={"status":"active"}). URL encoding ensures the JSON is transmitted correctly without corrupting the URL structure.
Shareable State Links
Single-page applications often encode UI state as JSON in the URL so users can share links that restore the exact view. URL encoding makes this JSON safe for browsers and routers.
HTTP GET Requests with JSON Bodies
Some APIs use GET requests with JSON in the query string instead of a request body. URL-encoding the JSON payload ensures it survives proxy servers, CDNs, and browser URL length limits.
Debugging and Logging
When logging API requests or building debugging tools, you often need to embed raw JSON in a URL-safe format. URL encoding lets you include full JSON payloads in log lines and dashboard URLs.
Frequently Asked Questions
What is the difference between encodeURIComponent and encodeURI?
encodeURIComponent encodes all characters except A-Z a-z 0-9 - _ . ! ~ * ' ( ). It is the right choice for encoding individual query parameter values, including JSON. encodeURI leaves structural URL characters (like /, ?, &) intact and is meant for encoding a full URL.
Does my JSON need to be valid before encoding?
No. This tool encodes any string, not just valid JSON. However, if you plan to decode it later, using valid, well-formed JSON will give you a clean round-trip result.
Will spaces be encoded as + or %20?
encodeURIComponent encodes spaces as %20, not +. The + encoding is used by the older application/x-www-form-urlencoded format. When passing JSON in a URL query string, %20 is the correct and unambiguous representation.
Is my data sent to a server?
No. All encoding happens entirely in your browser using the built-in JavaScript encodeURIComponent function. No data is transmitted anywhere.
How do I decode the result back to JSON?
Use our JSON URL Decoder tool, or call decodeURIComponent(encodedString) in your JavaScript code.
Related Tools
Explore more JSON and URL utilities on jsonparser.ai.