---
name: "up.Params.prototype.toQuery"
area: "API"
kind: "Instance method"
parent: "up.Params class"
url: "https://unpoly.com/api/up.Params.prototype.toQuery"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.Params class](https://unpoly.com/api/up.Params.md)</nav>

# up.Params.prototype.toQuery()

Returns a [query string](https://en.wikipedia.org/wiki/Query_string) for this [`up.Params`](https://unpoly.com/api/up.Params.md) instance.

The keys and values in the returned query string will be [percent-encoded](https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding). Non-primitive values (like [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File)) will be omitted from the returned query string.

## Example {#example}

```js
let params = new up.Params({ foo: 'bar', baz: 'bam' })
let query = params.toQuery()

// query is now: 'foo=bar&baz=bam'
```

---

## Return value {#return-value}

A query string built from this [`up.Params`](https://unpoly.com/api/up.Params.md) instance.

Type: string

