url split-query
for network
Converts query string into table applying percent-decoding.
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 │
╰───┴─────┴───────╯