> For the complete documentation index, see [llms.txt](https://docs.frends.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frends.com/tasks/tasks/avro/serialize.md).

# Serialize

Task version: 2.0.0

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.Avro>

## Task Parameters

{% tabs %}
{% tab title="Input" %}

| Name                      | Description                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Json : `String`           | <p>Input JSON string that can be both single objects and arrays of objects.</p><p>The JSON data will be serialized according to the provided Avro schema.</p><p><br>Default: <code>-</code><br>Example: <code>Single object: { "name": "Jerry", "age": 30, "city": "New York" } Array of objects: \[{ "name": "John", "age": 30 }, { "name": "Jane", "age": 25 }]</code></p>                                              |
| Schema : `String`         | <p>Avro Schema definition in JSON format that defines the structure of the data to be serialized.</p><p>Must be a valid Avro schema that matches the structure of the input JSON data.</p><p><br>Default: <code>-</code><br>Example: <code>{ "type": "record", "name": "Person", "fields": \[ { "name": "name", "type": "string" }, { "name": "age", "type": "int" }, { "name": "city", "type": "string" } ] }</code></p> |
| TargetFilePath : `String` | <p>Full path to the target file where the serialized Avro data will be stored.</p><p>The directory must exist and the file must not already exist (unless overwrite is enabled).</p><p><br>Default: <code>-</code><br>Example: <code>Windows: C:\data\output\myfile.avro Linux/Mac: /home/user/data/myfile.avro</code></p>                                                                                                |
| {% endtab %}              |                                                                                                                                                                                                                                                                                                                                                                                                                           |

{% tab title="Options" %}

| Name                             | Description                                                                                                                                                                                                                                                                                                                                  |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ThrowErrorOnFailure : `Boolean`  | <p>Determines error handling behavior. If true, throws an exception when serialization fails.</p><p>If false, returns error information in the Result object instead of throwing.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                     |
| ErrorMessageOnFailure : `String` | <p>Custom error message to use when ThrowErrorOnFailure is false and an error occurs.</p><p>If null or empty, the original exception message will be used.</p><p>This allows for user-friendly error messages in automated workflows.</p><p><br>Default: <code>-</code><br>Example: <code>Failed to serialize data to Avro format</code></p> |
| {% endtab %}                     |                                                                                                                                                                                                                                                                                                                                              |
| {% endtabs %}                    |                                                                                                                                                                                                                                                                                                                                              |

## Task Result

| Name                | Description                                                                                                                                                                                                                                     |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success : `Boolean` | <p>Indicates whether the serialization operation completed successfully. True if the JSON data was successfully serialized to Avro format, false if an error occurred.<br>Example: <code>true</code></p>                                        |
| FilePath : `String` | <p>Full path to the created Avro file when serialization is successful. Empty string when serialization fails.<br>Example: <code>C:\results\myfile.avro</code></p>                                                                              |
| Error : `Error`     | Error information when the serialization task fails and ThrowErrorOnFailure option is set to false. Contains detailed error message and additional debugging information. Null when the operation succeeds or when ThrowErrorOnFailure is true. |

## Task Changelog

Changelog for Task Frends.Avro.Serialize.

### \[2.0.0] - 2025-08-07

#### Changed

* \[Breaking] Renamed `OutputPath` parameter to `TargetFilePath` in Input tab
* Updated Result structure to include Success boolean and Error object

#### Added

* Added new Options tab with error handling parameters (ThrowErrorOnFailure, ErrorMessageOnFailure)

### \[1.0.0] - 2024-05-23

#### Added

* Initial implementation


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.frends.com/tasks/tasks/avro/serialize.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
