> For the complete documentation index, see [llms.txt](https://docs.deltastream.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.deltastream.io/reference/sql-syntax/data-format-serialization/serde-with-primitive-data.md).

# Serializing with Primitive Data Types

Serializing with primitive data types supports character strings, binary strings, and numeric data types. Below are a few (non-exhaustive) examples of serialization with primitive data types. See [the full list of supported primitive types](https://docs.deltastream.io/reference/sql-syntax/data-types#primitive-data-types).

### Character String

With the following DDL and query:

```sql
CREATE STREAM primitiveExample (
  "stringValue" VARCHAR
) WITH (
  'topic' = 'primitiveExample', 'value.format' = 'Primitive'
);
```

```sql
SELECT * FROM primitiveExample;
```

For the given input records:

```json
// input record bytes as String
abc

// output will read bytes as String
{ "stringValue": "abc" }
```

```json
// input record bytes as Integer
123

// output record will read bytes as String
{ "stringValue": "\u0000\u0000\u0000{" }
```

### Numeric

With the following DDL and query:

```sql
CREATE STREAM primitiveExample (
  "intValue" INTEGER
) WITH (
  'topic' = 'primitiveExample', 'value.format' = 'Primitive'
);
```

```sql
SELECT * FROM primitiveExample;
```

For the given input records:

```json
// input record bytes as Integer
123

// output will read bytes as Integer
{ "intValue": 123 }
```

```json
// input record bytes as String
abcd

// output will be read bytes as String
// It's also likely for other string bytes that there will be a 
// deserialization error while attempting to cast String to Integer
{ "intValue": 1633837924 }
```

### Binary String

With the following DDL and query:

```sql
CREATE STREAM primitiveExample (
  "bytesValue" VARBINARY
) WITH (
  'topic' = 'primitiveExample', 'value.format' = 'Primitive'
);
```

```sql
SELECT * FROM primitiveExample;
```

For the given input records:

```json
// input record bytes as Bytes
aG93ZHk=

// output will read bytes as Bytes
{ "bytesValue": "aG93ZHk=" }
```
