AvroConvert 2.2.1
See the version list below for details.
dotnet add package AvroConvert --version 2.2.1
NuGet\Install-Package AvroConvert -Version 2.2.1
<PackageReference Include="AvroConvert" Version="2.2.1" />
<PackageVersion Include="AvroConvert" Version="2.2.1" />
<PackageReference Include="AvroConvert" />
paket add AvroConvert --version 2.2.1
#r "nuget: AvroConvert, 2.2.1"
#:package AvroConvert@2.2.1
#addin nuget:?package=AvroConvert&version=2.2.1
#tool nuget:?package=AvroConvert&version=2.2.1
AvroConvert
Avro format combines readability of JSON format and compression of binary data serialization. <br></br>
The main purpose of the project was to enhance communication between microservices. Replacing JSON with Avro brought two main benefits:
- Reduced amount of data send via HTTP by about 30%
- Increased communication security - the data was not visible in plain JSON text
Documentation
General information: http://avro.apache.org/ <br></br> Wiki: https://cwiki.apache.org/confluence/display/AVRO/Index
Why choose Avro?
Benchmark with comparison to Newtonsoft.Json:
| Converter | Compression time [ms] | Compressed size [kB] |
|---|---|---|
| Json | 75 | 9945 |
| Avro (null encoding) | 307 | 2536 |
| Avro (Deflate encoding) | 155 | 207 |
| Avro (Snappy encoding) | 146 | 421 |
You can find the benchmark under tests/AvroConvertTests/Benchmark directory.
Conclusion: <br> Using Avro for communication between your services reduces up to almost 50 times (!!!) network traffic. This makes huge time and bandwidth savings.
Code samples
Serialization
byte[] avroObject = AvroConvert.Serialize(object yourObject);
Using encoding
byte[] avroObject = AvroConvert.Serialize(object yourObject, CodecType.Snappy);
Supported encoding types:
- Null (default)
- Deflate
- Snappy
- GZip
<br>
Deserialization
//Using generic method
CustomClass deserializedObject = AvroConvert.Deserialize<CustomClass>(byte[] avroObject);
//Using dynamic method
CustomClass deserializedObject = AvroConvert.Deserialize(byte[] avroObject, typeof(CustomClass));
Deserialization when a property value is null, but schema contains information about default value
//Model used for serialization
public class DefaultValueClass
{
[DefaultValue("Let's go")]
public string justSomeProperty { get; set; }
[DefaultValue(2137)]
public long? andLongProperty { get; set; }
}
//Deserializing object with null data
DefaultValueClass deserializedObject = AvroConvert.Deserialize<DefaultValueClass>(byte[] avroObject);
//Produces following object:
> deserializedObject.justSomeProperty
> "Let's go"
> deserializedObject.andLongProperty
> 2137
<br>
Generating Avro schema for C# classes
Using simple class
//Model
public class SimpleTestClass
{
public string justSomeProperty { get; set; }
public long andLongProperty { get; set; }
}
//Action
string schemaInJsonFormat = AvroConvert.GenerateSchema(typeof(SimpleTestClass));
//Produces following schema:
"{"type":"record","name":"AvroConvert.SimpleTestClass","fields":[{"name":"justSomeProperty","type":["null","string"]},{"name":"andLongProperty","type":"long"}]}"
Using class decorated with attributes
//Model
[DataContract(Name = "User", Namespace = "user")]
public class AttributeClass
{
[DataMember(Name = "name")]
public string StringProperty { get; set; }
[DataMember(Name = "favorite_number")]
[NullableSchema]
public int? NullableIntProperty { get; set; }
[DataMember(Name = "favorite_color")]
public string AndAnotherString { get; set; }
}
//Action
string schemaInJsonFormat = AvroConvert.GenerateSchema(typeof(AttributeClass));
//Produces following schema:
"{"type":"record","name":"user.User","fields":[{"name":"name","type":["null","string"]},{"name":"favorite_number","type":["null","int"]},{"name":"favorite_color","type":["null","string"]}]}"
<br />
Reading Avro schema from Avro encoded object
string schemaInJsonFormat = AvroConvert.GetSchema(byte[] avroObject)
<br>
Contribution
We want to improve AvroConvert as much as possible. If you have any idea, found next possible feature, optimization opportunity or better way for integration, leave a comment or pull request.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- AutoMapper (>= 8.0.0)
- Newtonsoft.Json (>= 12.0.2)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on AvroConvert:
| Package | Downloads |
|---|---|
|
Memphis.Client
Memphis.Client SDK intended to make easy integration of Memphis into .NET projects |
|
|
SolTechnology.Avro.Kafka
Library containing extensions for Confluent Kafka platform |
|
|
SolTechnology.Avro.Http
Library containing functionalities, which enable communication between microservices using Avro data format |
|
|
OptimoveSdk.Engager.Integration
SDK for Engagers intergration with Optimove |
|
|
SolTechnology.Core.ApiClient
Resilient HTTP client wrapper with built-in Polly retry policies, exponential backoff, circuit breaker patterns, and Avro serialization support. Simplifies external API integration with production-ready resilience patterns. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 3.4.16 | 66,015 | 9/18/2025 | |
| 3.4.15 | 136,250 | 3/31/2025 | |
| 3.4.14 | 102,117 | 3/19/2025 | |
| 3.4.12 | 40,380 | 3/7/2025 | |
| 3.4.11 | 29,748 | 3/6/2025 | |
| 3.4.10 | 149,047 | 10/21/2024 | |
| 3.4.9 | 165,211 | 9/18/2024 | |
| 3.4.8 | 342,650 | 5/8/2024 | |
| 3.4.7 | 32,852 | 4/26/2024 | |
| 3.4.6 | 68,873 | 3/4/2024 | |
| 3.4.5 | 40,343 | 2/15/2024 | |
| 3.4.4 | 63,380 | 1/16/2024 | |
| 3.4.3 | 118,144 | 12/9/2023 | |
| 3.4.2 | 37,836 | 12/1/2023 | |
| 3.4.1 | 43,632 | 11/11/2023 | |
| 3.4.0 | 61,165 | 9/18/2023 | |
| 3.3.7 | 55,244 | 8/7/2023 | |
| 3.3.6 | 79,877 | 5/29/2023 | |
| 3.3.5 | 37,274 | 5/11/2023 | |
| 3.3.4 | 114,225 | 3/3/2023 | |
| 3.3.3 | 29,315 | 2/28/2023 | |
| 3.3.2 | 50,586 | 2/6/2023 | |
| 3.3.1 | 31,735 | 1/27/2023 | |
| 3.3.0 | 172,237 | 10/11/2022 | |
| 3.2.9 | 107,652 | 6/22/2022 | |
| 3.2.8 | 31,261 | 6/1/2022 | |
| 3.2.7 | 31,360 | 5/23/2022 | |
| 3.2.6 | 29,618 | 5/16/2022 | |
| 3.2.5 | 91,249 | 4/13/2022 | |
| 3.2.4 | 29,582 | 4/10/2022 | |
| 3.2.3 | 59,263 | 10/29/2021 | |
| 3.2.2 | 59,897 | 10/2/2021 | |
| 3.2.1 | 29,872 | 9/29/2021 | |
| 3.2.0 | 37,276 | 9/14/2021 | |
| 3.1.5 | 54,416 | 8/30/2021 | |
| 3.1.4 | 34,734 | 8/12/2021 | |
| 3.1.3 | 36,434 | 8/2/2021 | |
| 3.1.2 | 33,219 | 6/24/2021 | |
| 3.1.1 | 29,922 | 6/14/2021 | |
| 3.1.0 | 55,773 | 5/15/2021 | |
| 3.0.1 | 35,852 | 4/2/2021 | |
| 3.0.0 | 53,857 | 3/26/2021 | |
| 2.7.1 | 85,050 | 2/5/2021 | |
| 2.7.0 | 63,527 | 12/18/2020 | |
| 2.6.3 | 31,918 | 10/25/2020 | |
| 2.6.2 | 29,284 | 10/23/2020 | |
| 2.6.1 | 33,109 | 7/25/2020 | |
| 2.6.0 | 29,348 | 7/22/2020 | |
| 2.5.1 | 30,294 | 6/11/2020 | |
| 2.5.0 | 50,395 | 5/15/2020 | |
| 2.4.1 | 30,265 | 4/14/2020 | |
| 2.4.0 | 29,776 | 3/25/2020 | |
| 2.3.0 | 30,046 | 3/19/2020 | |
| 2.2.2 | 29,899 | 2/7/2020 | |
| 2.2.1 | 29,374 | 2/7/2020 | |
| 2.2.0 | 29,452 | 1/27/2020 | |
| 2.1.0 | 29,365 | 1/16/2020 | |
| 2.0.0 | 29,363 | 1/4/2020 | |
| 1.8.1 | 9,767 | 12/9/2019 | |
| 1.8.0 | 12,804 | 8/30/2019 | |
| 1.7.0 | 9,548 | 8/22/2019 | |
| 1.6.0 | 9,566 | 7/22/2019 | |
| 1.5.1 | 9,692 | 7/14/2019 | |
| 1.5.0 | 9,666 | 7/11/2019 | |
| 1.4.0 | 9,534 | 6/17/2019 | |
| 1.3.0 | 9,563 | 6/4/2019 | |
| 1.2.0 | 9,634 | 6/3/2019 | |
| 1.1.0 | 9,614 | 5/28/2019 | |
| 1.0.1 | 9,670 | 5/21/2019 | |
| 1.0.0 | 30,145 | 4/24/2019 | |
| 0.8.0 | 30,049 | 5/1/2019 | |
| 0.7.0 | 30,199 | 4/22/2019 | |
| 0.6.3 | 30,035 | 4/19/2019 | |
| 0.6.2 | 30,045 | 4/19/2019 | |
| 0.6.1 | 30,043 | 4/19/2019 | |
| 0.6.0 | 30,054 | 4/19/2019 | |
| 0.5.0 | 30,259 | 4/18/2019 | |
| 0.3.0 | 30,553 | 4/11/2019 | |
| 0.2.1 | 10,252 | 4/11/2019 | |
| 0.2.0 | 10,196 | 4/11/2019 | |
| 0.1.0 | 10,480 | 4/10/2019 |