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 exactly what you typed, whitespace and line breaks included. The RFC 3986 URI standard specifies which characters are safe in a URL and which must be percent-encoded. Tip: minify the JSON first (no newlines, no indentation) and the encoded result gets much shorter. The reverse operation is handled by the 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, or click Sample to load a small filter object. The JSON doesn't have to be valid: any text gets encoded, and a yellow note appears above the output if it isn't valid JSON. If you want to check the syntax first, the MDN JSON reference and the RFC 8259 grammar are good references.
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
How do encodeURIComponent and encodeURI differ?
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. Any text gets encoded, and a note above the output tells you when it isn't valid JSON. If you plan to decode it as JSON later, fix the syntax first so the round trip gives you something a parser accepts.
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 the JSON URL Decoder tool, or call decodeURIComponent(encodedString) in your JavaScript code.
Related Tools
Explore more JSON and URL utilities on jsonparser.ai.