url build-query

For network.

Converts record or table into query string applying percent-encoding.

Command Type

built-in

Signature

> url build-query {flags}

Input/output types:

input output
record string
table<key: any, value: any> string

Examples

Outputs a query string representing the contents of this record.

> { mode:normal userid:31415 } | url build-query
mode=normal&userid=31415

Outputs a query string representing the contents of this record, with a value that needs to be URL-encoded.

> {a:"AT&T", b: "AT T"} | url build-query
a=AT%26T&b=AT+T

Outputs a query string representing the contents of this record, “exploding” the list into multiple parameters.

> {a: ["one", "two"], b: "three"} | url build-query
a=one&a=two&b=three

Outputs a query string representing the contents of this table containing key-value pairs.

> [[key, value]; [a, one], [a, two], [b, three], [a, four]] | url build-query
a=one&a=two&b=three&a=four

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.