Query string to JSON

Read a URL's parameters as JSON, or build a query string from an object, with repeated keys handled as the arrays they are.

Direction
txt
JSONjson
The result appears here

Questions

What happens to a key that appears twice?+

It becomes an array. tag=jazz&tag=harp is two values for one key, and an object with one of them silently dropped is how half the pagination bugs on the web start.

Can I paste a whole URL?+

Yes. Everything before the ? is ignored, so you can paste the address straight out of the bar.

Is the encoding handled?+

Yes, by URLSearchParams itself, which is the browser's own implementation: %20 and + both come back as spaces, and going the other way the values are escaped properly.

Related tools

The tools are free. So is most of the library.

1935 blocks and 989 pieces for shadcn/ui and Tailwind, built on the same tokens these tools write. Install one with a command and the code is yours.

No signup for the tools. MIT for free blocks, commercial licence for Pro.

Markdown version