Although Jackson has had Avro backend for quite a while -- in fact, it
was introduced in 2.1, over 4 years ago -- it hasn't been widely
adopted, and feature-wise there has been much development
aside from bug fixes (big thank you to all adopters who have reported them!).

Lately there have been a few requests for improvements, and I finally
found time to do some work.
As a result, former limitations (up to 2.8.6 / 2.7.8):

1. Only Avro Records (~= JSON Objects) and Arrays were allowed as root value
2. Only single root value supported, not sequences (unlike with JSON)

have been removed so that, with next releases (2.8.7, 2.9.0, possibly 2.7.9):

1. All legal Avro types (for which Schema may be written) can be read
and written as the root value (most importantly Avro Maps, but also
scalars)
2. Root value sequences work fine, via standard Jackson databind:

   MappingIterator<POJO> it = mapper.readerFor(POJO.class)
       .with(schemaForPOJO)
       .readValues(source);
  while (it.hasNextValue()) {
      POJO value = it.nextValue();
      // ...
   }

   SequenceWriter w = mapper.writer(schemaForPOJO)
       .writeValues(target);
    w.write(pojo1);
    w.write(pojo2);

I intend to work some more on this module, to hopefully also support:

- Reader/writer schemas for reading (deserialization), as per Avro's
schema evolution
- (maybe) Support default values better (needed for most evolution)
- (eventually) Support for "logical types" concept later versions of
Avro are starting to support
- (eventually) Handle avro-json-schema-prefixed File format (currently
only "raw" data is handled)

What would be extremely helpful would be to have more users testing
this functionality.
All other help is appreciated too, of course, but even simple things
like kicking the tires to see if Jackson Avro module could actually
simplify things would be helpful.
For what it is worth, my own use cases mostly involved transformations
between Avro and JSON, and this is area where I think Jackson offers
significantly better solution than Avro reference implementation --
clean JSON without non-standard type indicators. But beyond JSON,
Jackson supports wide variety of formats and I suspect that things
that would really interest users are:

- Convert from Avro to CSV, back
- Convert Avro to/from XML

-+ Tatu +-

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to