How to create schema containing list of objects using Avro?

You need to use array type for creating the list. Following is the updated schema that handles your usecase.

{
    "name": "Parent",
    "type":"record",
    "fields":[
        {
            "name":"children",
            "type":{
                "type": "array",  
                "items":{
                    "name":"Child",
                    "type":"record",
                    "fields":[
                        {"name":"name", "type":"string"}
                    ]
                }
            }
        }
    ] 
}

LEAVE A COMMENT