# Convert

**Description**\
The subcommands can be required to pack and unpack transactions as well as to convert data from JSON format to digital code and vice versa.

**Subcommands**

* [Pack Action Data](/software_manuals/command_reference/convert.md#pack-action-data) — From JSON action data to packed form.
* [Pack Transaction](/software_manuals/command_reference/convert.md#pack-transaction) — From plain signed JSON to packed form.
* [Unpack Action Data](/software_manuals/command_reference/convert.md#unpack-action-data) — From packed to JSON action data form.
* [Unpack Transaction](/software_manuals/command_reference/convert.md#unpack-transaction) — From packed to plain signed JSON form.

## Pack Action Data

### Description

The subcommand converts action data from JSON format to packed form.

### Positional Parameters

* `(string) account` — The name of the account that hosts the contract (required).
* `(string) name` — The name of the function that's called by this action (required).
* `(string) unpacked_action_data` — The action data expressed as JSON (required).

### Options

No options required for this subcommand.

### Command

```bash
$ cleos convert pack_action_data <account> <name> <unpacked_action_data>
```

### Examples

```bash
$ cleos convert pack_action_data c.gallery unlinkauth '{"account":"test1", "code":"test2", "type":"cybertype"}'
```

```
000000003500b1be00000000008fa1ca0000a47deaea2903
```

## Pack Transaction

### Description

The subcommand converts a transaction from plain signed JSON to packed form.

### Positional Parameters

* `(string) transaction` — The plain signed JSON (required).

### Options

* `--pack-action-data` — Pack all action data within transaction, needs interaction with `nodeos`.

### Command

```bash
$ cleos convert pack_transaction [OPTIONS] <transaction>
```

### Examples

```bash
$ cleos convert pack_transaction '{
  "expiration": "2020-02-02T18:01:32",
  "ref_block_num": 22654,
  "ref_block_prefix": 4107128227,
  "max_net_usage_words": 0,
  "max_cpu_usage_ms": 0,
  "max_ram_kbytes": 0,
  "max_storage_kbytes": 0,
  "delay_sec": 0,
  "context_free_actions": [],
  "actions": [{
      "account": "c.gallery",
      "name": "create",
      "authorization": [{
          "actor": "cmnwrtlcdzcl",
          "permission": "active"
        }
      ],
      "data": "0000000000fe...3d8ab000000"
    }
  ],
  "transaction_extensions": []
}'
```

```
{
  "signatures": [],
  "compression": "none",
  "packed_context_free_data": "",
  "packed_trx": "7429ab7f379...00000"
}
```

## Unpack Action Data

### Description

The subcommand converts action data from packed to JSON format.

### Positional Parameters

* `(string) account` — The name of the account that hosts the contract (required).
* `(string) name` — The name of the function that's called by this action (required).
* `(string) packed_action_data` — The action data expressed as packed hex string (required).

### Options

No options required for this subcommand.

### Command

```bash
$ cleos convert pack_action_data <account> <name> <unpacked_action_data>
```

### Examples

```bash
$ cleos convert unpack_action_data c.gallery unlinkauth 000000003500b1be00000000008fa1ca0000a47deaea2903
```

```
{
  "account": "test1",
  "code": "test2",
  "type": "cybertype"
}
```

## Unpack Transaction

### Description

The subcommand converts a transaction from packed to plain signed JSON form.

### Positional Parameters

* `(string) transaction` — The packed transaction JSON (string containing packed\_trx and optionally compression fields) (required).

### Options

* `--unpack-action-data` — Unpack all action data within transaction, needs interaction with `nodeos`.

### Command

```bash
$ cleos convert unpack_transaction [OPTIONS] <transaction>
```

### Examples

```bash
$ cleos convert unpack_transaction '{
  "signatures": [
    "SIG_K1_K6gS7...YE596eh"
  ],
  "compression": "none",
  "packed_context_free_data": "",
  "packed_trx": "7429ab7f379...00000"
}'
```

```
{
  "expiration": "2020-02-02T18:01:32",
  "ref_block_num": 22654,
  "ref_block_prefix": 4107128227,
  "max_net_usage_words": 0,
  "max_cpu_usage_ms": 0,
  "max_ram_kbytes": 0,
  "max_storage_kbytes": 0,
  "delay_sec": 0,
  "context_free_actions": [],
  "actions": [{
      "account": "c.gallery",
      "name": "create",
      "authorization": [{
          "actor": "cmnwrtlcdzcl",
          "permission": "active"
        }
      ],
      "data": "0000000000fe...3d8ab000000"
    }
  ],
  "transaction_extensions": [],
  "signatures": [
    "SIG_K1_K6gS7...YE596eh"
  ],
  "context_free_data": []
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cyberway.io/software_manuals/command_reference/convert.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
