# Cbor.decode

Decodes CBOR (Concise Binary Object Representation) data into a JavaScript value.

## Imports

:::code-group
```ts [Named]
import { Cbor } from 'ox'
```

```ts [Entrypoint]
import * as Cbor from 'ox/Cbor'
```
:::

## Examples

```ts twoslash
import { Cbor } from 'ox'

Cbor.decode('0x83010203')
// @log: [1, 2, 3]

Cbor.decode('0xa263666f6f636261726362617a83010203')
// @log: { foo: 'bar', baz: [1, 2, 3] }

Cbor.decode(new Uint8Array([101, 104, 101, 108, 108, 111]))
// @log: 'hello'
```

## Definition

```ts
function decode<type>(
  data: Hex.Hex | Bytes.Bytes,
): type
```

**Source:** [src/core/Cbor.ts](https://github.com/wevm/ox/blob/main/src/core/Cbor.ts#L970)

## Parameters

### data

* **Type:** `Hex.Hex | Bytes.Bytes`

The CBOR-encoded data to decode.

## Return Type

The decoded value.

`type`
