Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Furl%2Furldecode.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Furl%2Furldecode.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `urlDecode`

## Description

Returns the decoded version of a URL-encoded string.

URL encoding replaces certain characters with escape sequences (for example, spaces become `%20`) so they can be safely transmitted in URLs. Use `urlDecode` to restore the original values after parsing.

## Syntax

Like many functions in DataPrime, `urlDecode` supports<!-- --> [two notations](https://docs-docusaurus.kinsta.page/dataprime/language-reference/functions-reference/.md),<!-- --> **function** and **method**. These interchangeable forms allow flexibility in how you structure expressions.

* Function notation
* Method notation

```
urlDecode(string: string): string
```

```
(string: string).urlDecode(): string
```

## Arguments

| Name     | Type     | Required | Description                      |
| -------- | -------- | -------- | -------------------------------- |
| `string` | `string` | **true** | The URL-encoded string to decode |

## Example

**Use case: Decode query string parameters**

Suppose you want to parse query string parameters and decode any encoded values. Consider this document:

```
{

  "domain": "https://www.coralogix.com",

  "path": "/home",

  "query_string": "name=Tom%20Kosman&b=c&c=d"

}
```

First, extract the parameters into an object using `kv`:

```
extract query_string into query_string_parameters using kv(pair_delimiter='&', key_delimiter='=')
```

This produces:

```
{

  "domain": "https://www.coralogix.com",

  "path": "/home",

  "query_string": "name=Tom%20Kosman&b=c&c=d",

  "query_string_parameters": {

    "name": "Tom%20Kosman",

    "b": "c",

    "c": "d"

  }

}
```

Now decode the `name` field:

### Example query

* Function notation
* Method notation

```
replace query_string_parameters.name with urlDecode(query_string_parameters.name)
```

```
replace query_string_parameters.name with query_string_parameters.name.urlDecode()
```

### Example output

```
{

  "domain": "https://www.coralogix.com",

  "path": "/home",

  "query_string": "name=Tom%20Kosman&b=c&c=d",

  "query_string_parameters": {

    "name": "Tom Kosman",

    "b": "c",

    "c": "d"

  }

}
```
