Thanks Doug.

yes  the 2 lines you showed are exactly what I'm doing now.
but that gives me a result like

{my_first_record .....}
 {my_second_record....}

note there is a space at the very front of the second line.


let me try out the MinimalPrettyPrinter,

Yang

On Tue, Oct 4, 2011 at 11:19 AM, Doug Cutting <[email protected]> wrote:
> 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
>

Reply via email to