Xerobit

Convert URL Params to JSON

Paste a full URL or just the query string to convert URL params to JSON. The tool extracts every key-value pair, decodes percent-encoded characters, groups duplicate keys into arrays, and outputs formatted JSON. It runs entirely in your browser so nothing is uploaded.

Paste a full URL or just the part after the question mark.

Remove everything after # before parsing parameters.

JSON Output

{
  "name": "Alice",
  "age": "30"
}

How to use the url params to json converter

  1. Paste a full URL or just the query string into the input area.
  2. Toggle Ignore fragment if your URL contains a hash you want stripped before parsing.
  3. The JSON output updates automatically as you type.
  4. Copy the result for use in your code, API calls, or configuration files.

How URL parameters are parsed

A URL query string begins after the first ? character and consists of key-value pairs separated by &. Each pair is split on the first = sign. Both keys and values are percent-decoded: sequences like %20 become spaces, and + signs are also treated as spaces per the application/x-www-form-urlencoded specification.

For example, the string name=John+Doe&city=New%20York produces two entries. The key name maps to John Doe and the key city maps to New York. When converting url params to JSON, these become string properties in an object.

Handling duplicate keys

Standard JSON objects cannot have duplicate property names. When a query string contains the same key more than once, such as tag=js&tag=web&tag=api, this converter collects all values into a JSON array. The result is {"tag": ["js", "web", "api"]}.

If a key appears only once, its value remains a plain string rather than a single-element array. This matches the behavior of many server-side frameworks and keeps the output clean for typical use cases where most parameters are unique.

Common parameter patterns

Query stringJSON output
a=1&b=2{"a":"1","b":"2"}
x=&y=hello{"x":"","y":"hello"}
flag{"flag":""}
k=a%26b{"k":"a&b"}
c=1&c=2{"c":["1","2"]}

Note that all values remain strings. The number 1 in a query string becomes "1" in JSON because URL parameters carry no type information. If you need typed values, apply a schema transformation after conversion.

Practical uses for URL params to JSON conversion

Developers frequently need to inspect or transform query parameters when debugging APIs, building analytics pipelines, or migrating data between systems. Converting url params to JSON makes it easy to feed web request data into tools that expect structured input.

Other format converters handle different source types. For instance, query string to JSON covers raw query strings specifically, while env to JSON and ini to JSON handle configuration files. Use the right tool for your input format to avoid manual cleanup.

Edge cases and encoding rules

Several edge cases can trip up naive parsers. A bare key without an equals sign, like verbose, is treated as having an empty string value. An equals sign with nothing after it, like q=, also yields an empty string. Multiple consecutive ampersands, such as a=1&&b=2, produce empty keys that are typically ignored.

Percent-encoding follows RFC 3986. Characters outside the unreserved set must be encoded as %XX hex pairs. The plus sign (+) is decoded as a space only in query strings, not in the path portion of a URL. This converter applies form-decoding rules to the extracted query portion, matching how browsers and servers handle submitted form data.

Worked examples

ExampleInputResult
Simple parametersURL or query string: name=Alice&age=30; Ignore fragment (hash): yes{ / "name": "Alice", / "age": "30" / }
Full URL with duplicatesURL or query string: https://example.com/search?q=test&lang=en&q=hello; Ignore fragment (hash): yes{ / "q": [ / "test", / "hello" / ], / "lang": "en" / }
Encoded valuesURL or query string: msg=hello%20world&symbol=%26%3D%3F; Ignore fragment (hash): yes{ / "msg": "hello world", / "symbol": "&=?" / }

FAQ

Does this tool upload my URL to a server?

No. The conversion from url params to JSON happens entirely in your browser using JavaScript. Nothing is sent over the network.

Can I paste a full URL instead of just the query string?

Yes. The tool automatically extracts the portion after the question mark. You can paste complete URLs including scheme, host, path, and fragment.

What happens if a parameter key appears multiple times?

Duplicate keys are grouped into a JSON array. For example, a=1&a=2 becomes {"a": ["1", "2"]}. Single-occurrence keys remain plain strings.

Are numeric values converted to JSON numbers?

No. URL parameters have no type information, so all values are kept as JSON strings. Convert them to numbers in your own code if needed.

How are special characters handled?

Percent-encoded sequences like %20 and %26 are decoded to their original characters. Plus signs are also decoded as spaces, following standard form-encoding rules.

What does the Ignore fragment option do?

When enabled, anything after a hash symbol is removed before parsing. This prevents fragment identifiers from being treated as parameter values.