Convert Avro document to Json in Python using fastavro
✓ Published0🌍 Public
Aadkdev
Last edited Aug 22, 2021
Created on Aug 22, 2021
This example converts Avro files into a single JSON document using Python’s `fastavro` library. It reads all `.avro` files from hourly subdirectories under a date-partitioned S3 path, iterates through records with `fastavro.reader`, and accumulates them into a list. The script then writes the collected data to `out.json` with `json.dump`, using sorted keys and indentation for readability. The code demonstrates batch processing of Avro data from multiple files into a structured, human-readable JSON output.
AI-generated description