Can this be used to deserialize an avro file to json? #307
famattsson
started this conversation in
General
Replies: 1 comment 6 replies
-
It does, you should be able to do something like: var schema = new JsonSchemaReader.Read("...");
var deserialize = new BinaryDeserializerBuilder().BuildDelegate<dynamic>(schema);
var serialize = new JsonSerializerBuilder().BuildDelegate<dynamic>(schema);
using var stream = new MemoryStream();
using var writer = new Utf8JsonWriter(stream)
{
serialize(deserialize(new BinaryReader(File.ReadAllBytes("..."))), writer);
}
var json = stream.ToString(); If you want "regular JSON" instead of Avro JSON, you could also just use the System.Text.Json serializer instead of the Chr.Avro one. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an avro file in binary that I want to convert into a json string. Does this project support that?
Beta Was this translation helpful? Give feedback.
All reactions