Avro – Unions

As a boolean:

{
	"fieldOne": "hello world",
	"fieldTwo": true,
	"foobar": {
		"boolean": false
	}
}

If value is null:

{
	"fieldOne": "hello world",
	"fieldTwo": true,
	"foobar": null
}

The above is what a field will look like as output where in Avro that field is defined as one of the Complex Types – Unions. Example below, it declares a schema which may be one of null or boolean.

{
  "type": [
    "null", 
    "boolean"
  ]
}