avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: space " " produced in jsonencoder ?
Date Tue, 04 Oct 2011 18:19:47 GMT
You could insert something like the following between each call to write():

  encoder.flush();
  ostream.write((byte)'\n');

or you could pass a JsonGenerator to EncoderFactory#jsonEncoder a
MinimalPrettyPrinter whose rootValueSeparator is set to "\n".

http://jackson.codehaus.org/1.8.4/javadoc/org/codehaus/jackson/util/MinimalPrettyPrinter.html

Perhaps we do this by default for JSON output?  If you feel this is the
case, please file an issue in Jira.

https://issues.apache.org/jira/browse/AVRO

Thanks,

Doug

On 10/04/2011 10:57 AM, Yang wrote:
> if I do
> 
> writer = new SpecificDatumWriter<SpecificRecord>(schema);
> encoder = EncoderFactory.get().jsonEncoder(schema, ostream);
> 
> writer.write(my_specific_record, encoder);
> writer.write(my_specific_record.encoder);
> 
> 
> it adds a space " " between the 2 records, I guess for separation.
> is it possible to remove that? or changing that to "\n" is much better
> 
> 
> Thanks
> Yang

Mime
View raw message