gogen-avro icon indicating copy to clipboard operation
gogen-avro copied to clipboard

how to filter the 'null' in MarshalJSON()?

Open Cyberpunk314 opened this issue 2 years ago • 1 comments

for example, there is a result for MarshalJSON() function.

{"bucket":{"int":0},"buckets":null,"docid":null}

I want to filter the 'null' in this case.

Cyberpunk314 avatar Mar 11 '22 10:03 Cyberpunk314

@Cyberpunk314 You want to encode the record as JSON but you want to omit the empty fields? This library generates structs that serialize to JSON according to the Avro spec, which means the MarshalJSON method includes null fields.

actgardner avatar Apr 16 '22 20:04 actgardner