# node:querystring

> How Elide supports Node's legacy `querystring` module for parsing and formatting query strings: it matches Node; prefer URLSearchParams in new code.

`node:querystring` matches [Node's `querystring`](https://nodejs.org/api/querystring.html); use `URLSearchParams` in
new code.

## Example

```js
// qs.mjs
import querystring from "node:querystring";

const parsed = querystring.parse("tag=a&tag=b&q=hello%20world");
console.log(JSON.stringify(parsed));
console.log(querystring.stringify({ q: "café & co", page: 2 }));
console.log(querystring.escape("a b"), querystring.unescape("a%20b"));
```

`elide run qs.mjs` prints:

```text
{"tag":["a","b"],"q":"hello world"}
q=caf%C3%A9%20%26%20co&page=2
a%20b a b
```

<!-- api-reference:start 533f2f2ddc1e -->
## Reference

**Status:** Full · Not measured · since 1.1.0

### Exports

| Export | Kind | Status | Notes |
| --- | --- | --- | --- |
| `parse()` | function | Full | Parses a URL query string into a key-value object |
| `stringify()` | function | Full | Serializes an object into a URL query string |
| `escape()` | function | Full | Percent-encodes a string for use in a query string |
| `unescape()` | function | Full | Decodes a percent-encoded query string component |
| `encode()` | function | Full | Alias for stringify(); serializes an object into a query string |
| `decode()` | function | Full | Alias for parse(); parses a query string into a key-value object |
<!-- api-reference:end -->
