Michael
Michael

Reputation: 22967

Can Avro schema have unknown / dynamic field names?

Consider the following json:

{
  "id": "5ffhj4ksWRyt",
  "name": "some name",
  "custom_fields": [
    "randomFieldName1": "a",
    "randomFieldName2": "b"
  ]

id and name fields are always known, but custom_fields names are dynamic and can have any key name. Is it possible to write a schema that will take that into account ?

Upvotes: 1

Views: 2525

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191983

You can define custom_fields as a map

https://avro.apache.org/docs/current/spec.html#Maps

Upvotes: 1

Related Questions