url split-query

For network.

Converts query string into table applying percent-decoding.

Command Type

built-in

Signature

> url split-query {flags}

Input/output types:

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

Examples

Outputs a table representing the contents of this query string.

> "mode=normal&userid=31415" | url split-query
╭───┬────────┬────────╮
│ # │  key   │ value  │
├───┼────────┼────────┤
│ 0 │ mode   │ normal │
│ 1 │ userid │ 31415  │
╰───┴────────┴────────╯

Outputs a table representing the contents of this query string, url-decoding the values.

> "a=AT%26T&b=AT+T" | url split-query
╭───┬─────┬───────╮
│ # │ key │ value │
├───┼─────┼───────┤
│ 0 │ a   │ AT&T  │
│ 1 │ b   │ AT T  │
╰───┴─────┴───────╯

Outputs a table representing the contents of this query string.

> "a=one&a=two&b=three" | url split-query
╭───┬─────┬───────╮
│ # │ key │ value │
├───┼─────┼───────┤
│ 0 │ a   │ one   │
│ 1 │ a   │ two   │
│ 2 │ b   │ three │
╰───┴─────┴───────╯

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