# GTXValue · Rell standard library · Chromia Docs (concept)

> alias GTXValue = gtv Deprecated (for removal): Use 'gtv' instead Generic Transfer Value (GTV) is a data type for the serialization and transfer of structur

Source: https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/-g-t-x-value/

ALIAS

# GTXValue

```signature
alias GTXValue = gtv
```

**Deprecated** (for removal): Use 'gtv' instead

Generic Transfer Value (GTV) is a data type for the serialization and transfer of structured data, much
like JSON.

GTV is used in Rell to encode operation and query arguments and results that are exchanged with clients.
Unlike JSON, GTV has a stable byte serialization format and well-defined cryptographic hash, making it
well-suited to this purpose. In addition, GTV supports byte arrays.

GTV supports the following types:

| GTV Type | Closest Rell Equivalent |
| --- | --- |
| `NULL` | `null` |
| `BYTEARRAY` | `byte_array` |
| `STRING` | `text` |
| `INTEGER` | `integer` |
| `DICT` | `map<text, gtv>` |
| `ARRAY` | `list<gtv>` |
| `BIGINTEGER` | `big_integer` |

GTV does not support all Rell types, so not every value in Rell can be converted to GTV. For example,
GTV has no support for non-integer numbers, and therefore the `decimal` type is encoded in GTV as
text.

Rell types can be encoded as GTV in two modes: *compact* and *pretty*, and the distinction between the
two is a real semantic difference, and is not merely a difference in whitespace when converted to text.
The two modes differ in the following ways:

* Compact GTV encode struct values as a lists of attributes, while pretty GTV encode them as a
  dictionaries (thus struct member names are preserved).
* Compact GTV encode named-field tuples as a lists of attributes, while pretty GTV encode them as a
  dictionaries (thus tuple field names are preserved). There is no difference between the two in
  encoding of unnamed-field tuples.

Examples of GTV:

Rell

```
>>> (x = 1, y = 'a', z = true).to_gtv()
[1,"a",1]
>>> (x = 1, y = 'a', z = false).to_gtv_pretty()
{"x":1,"y":"a","z":0}
>>> [1: 'a', 2: 'b', 3: 'c'].to_gtv()
[[1,"a"],[2,"b"],[3,"c"]]
>>> [1: 'a', 2: 'b', 3: 'c'].to_gtv_pretty()
[[1,"a"],[2,"b"],[3,"c"]]
>>> set([1, 2, 3, 4]).to_gtv()
[1,2,3,4]
>>> set([1, 2, 3, 4]).to_gtv_pretty()
[1,2,3,4]
>>> struct a { x: integer; y: decimal; };
>>> a(10, 10.1).to_gtv()
[10,"10.1"]
>>> a(10, 10.1).to_gtv_pretty()
{"x":10,"y":"10.1"}
```

Rell operations expect their arguments as compact-encoded GTV, whereas queries expect pretty-encoded GTV
arguments, hence client applications are required to use those respective formats when making operation
and query calls to Rell applications.

Since 0.9.0

**Alias of** [gtv](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/gtv/)

[View this page on docs.chromia.com](https://docs.chromia.com/pages/rell-stdlib/-rell%20-system%20-library/%5Broot%5D/-g-t-x-value.html)Generated API reference, mirrored from the live docs
