Mastodon

JSON URL Decode

How to Use JSON URL Decoder

We kept the interface clean and distraction-free so you can get your work done fast. Here is the step-by-step:

  1. Paste Your Data: Copy the URL-encoded string you are trying to decipher and paste it into the top box labeled “Enter URL Encoded String.”
  2. Upload a File (Optional): Have a large encoded string saved in a text document? You don’t need to open it and copy-paste. Just click the “Upload .txt File” button to load it directly.
  3. Click Decode: Hit the blue “Decode String” button.
  4. Get Your Result: Instantly, the readable code will appear in the bottom box labeled “Decoded JSON Output.”
  5. Copy & Go: Need to move that data to your code editor? Just click “Copy Output” and you are set.

If you need to start over, the “Clear All” button wipes both fields clean instantly.

If you need to reverse this operation to prepare raw JSON for an API query parameter, use our JSON URL Encode tool.

How JSON URL Decoding Works

URL encoding (also known as percent-encoding) follows the RFC 3986 standard. Because Uniform Resource Identifiers (URIs) only permit a specific set of unreserved ASCII characters (alphanumeric characters plus -, _, ., and ~), all other characters must be converted before transmission over HTTP.

When a JSON payload is passed through a URL query parameter (for example, ?data=%7B%22status%22%3A%22success%22%7D), the raw JSON structural characters undergo a two-step transformation:

  1. UTF-8 Byte Conversion: Non-ASCII or special characters are split into their UTF-8 byte equivalents.
  2. Hexadecimal Triplet Representation: Each byte is prefixed with a % sign followed by its two-digit hexadecimal representation.

Plaintext

Original JSON:  {"user":"alex"}
Percent-Encoded: %7B%22user%22%3A%22alex%22%7D

When you paste an encoded string into the decoder, the tool reverses this process:

  • %7B converts back to {
  • %22 converts back to "
  • %3A converts back to :
  • %7D converts back to }
  • %20 or + converts back to a space character

Common Use Cases for URL-Encoded JSON

Developer workflows frequently encounter percent-encoded JSON payloads across different network layers and logging setups:

1. Webhook Callbacks and Redirect URLs

OAuth providers and payment gateways often append metadata or state objects directly into callback URLs. For instance, payment status confirmations may pass encoded session state through query parameters. Decoding this string lets developers inspect transaction IDs, token attributes, and signature values.

2. Microservice Query Parameters

GET requests do not support a standard HTTP request body in the same way POST or PUT requests do. Some APIs bypass this limitation by passing complex filter objects as JSON inside URL query parameters:

HTTP

GET /api/v1/products?filter=%7B%22category%22%3A%22electronics%22%2C%22inStock%22%3Atrue%7D

Decoding this query parameter reveals the underlying search filter: {"category":"electronics","inStock":true}.

3. Server Access Logs and Analytics Tools

Log management platforms like Kibana, Datadog, and CloudWatch log raw incoming URLs exactly as received by Nginx or Apache. When debugging failed requests or routing errors, engineers copy these percent-encoded log entries into the decoder to examine the underlying request payload.

4. Single Sign-On (SSO) and JWT Tokens

While JSON Web Tokens (JWTs) rely on Base64URL encoding, embedded metadata inside URL redirects often combines URL encoding with escape characters. If your payload includes backslashes or escaped quotes inside decoded text, you can process the raw result using our JSON Escape / Unescape utility.

Code Snippets: How to Decode URL Strings Programmatically

If you are building an application that receives encoded URL parameters, you must handle decoding natively within your runtime environment.

JavaScript / Node.js

In modern JavaScript environments, use decodeURIComponent() to handle RFC 3986 percent-encoded query parameter values:

JavaScript

const encodedParam = "%7B%22id%22%3A101%2C%22role%22%3A%22admin%22%7D";
const decodedJsonString = decodeURIComponent(encodedParam);
const jsonObject = JSON.parse(decodedJsonString);

console.log(jsonObject.role); // Outputs: admin

Python

Python provides the urllib.parse module in its standard library:

Python

import json
from urllib.parse import unquote

encoded_param = "%7B%22id%22%3A101%2C%22role%22%3A%22admin%22%7D"
decoded_string = unquote(encoded_param)
data = json.loads(decoded_string)

print(data["role"])  # Outputs: admin

PHP

In PHP, use rawurldecode() for standard RFC 3986 URL decoding:

PHP

$encodedParam = "%7B%22id%22%3A101%2C%22role%22%3A%22admin%22%7D";
$decodedString = rawurldecode($encodedParam);
$data = json_decode($decodedString, true);

echo $data['role']; // Outputs: admin

Java

Java applications can decode URL components using URLDecoder from java.net:

Java

import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) {
        String encoded = "%7B%22id%22%3A101%2C%22role%22%3A%22admin%22%7D";
        String decoded = URLDecoder.decode(encoded, StandardCharsets.UTF_8);
        System.out.println(decoded);
    }
}

Once your string is decoded into standard JSON format, you can format and validate its structure visually using our JSON Viewer.

Character Encoding Reference Table

The following table summarizes common JSON characters and their corresponding percent-encoded representations in URLs:

CharacterNamePercent-Encoded Value
{Left Curly Bracket%7B
}Right Curly Bracket%7D
"Double Quote%22
:Colon%3A
,Comma%2C
[Left Square Bracket%5B
]Right Square Bracket%5D
SpaceSpace Character%20 or +
/Forward Slash%2F
\Backslash%5C

Frequently Asked Questions (FAQ)

What is JSON URL decoding?

JSON URL decoding is the process of converting percent-encoded characters (like %7B and %22) back into standard JSON characters (like { and "). This makes raw URL parameters readable for humans and parsable for standard JSON libraries.

Why do APIs send JSON inside URLs instead of HTTP request bodies?

Certain HTTP methods, such as GET, do not support a request body according to HTTP standards. When clients must pass structured parameters to a GET endpoint, they serialize the object into JSON and percent-encode it within the URL query string.

How does this tool handle spaces encoded as + versus %20?

URL query strings following form encoding norms often convert spaces to +, whereas strict RFC 3986 percent-encoding represents spaces as %20. This tool automatically handles both conventions and converts both symbols back into standard spaces.

Is my data safe when pasting sensitive JSON into this decoder?

Yes. All decoding execution takes place entirely within your local web browser using client-side JavaScript. Your text and file payloads are never transmitted to external servers or logged in remote databases.

What is the difference between URL decoding and JSON unescaping?

URL decoding replaces %XX hexadecimal triplets with their original ASCII/UTF-8 characters. JSON unescaping removes backslash escape sequences (such as \" or \\) inserted inside string representations of JSON.

Why does my decoded JSON string fail to parse with JSON.parse()?

If your decoded text still causes syntax errors, the payload may have been encoded twice (double encoding), truncated by URL length limits, or contains unescaped internal quotes. Check the decoded output for missing brackets or invalid trailing commas.

Can I decode multi-byte UTF-8 characters like emojis or foreign language text?

Yes. The decoder parses UTF-8 byte sequences correctly. Multi-byte characters (such as accented characters or non-Latin alphabets) that were percent-encoded as multiple byte pairs will decode back into their original Unicode representation.

How can I decode very large log files?

Use the Upload .Txt File button under the input area. You can upload large text files containing encoded strings directly from your computer without needing to manual copy and paste large payloads into the browser box.

What happens if I attempt to decode a string that is already decoded?

If you run an unencoded, standard JSON string through a URL decoder, the string remains largely unchanged unless it contains literal % characters followed by two hexadecimal digits.

What JavaScript function should I use for URL decoding in production?

In JavaScript, use decodeURIComponent() for decoding individual query parameter values. Avoid using the deprecated unescape() function, as it does not correctly support UTF-8 character encoding standards.