GitHub user joemeszaros opened a pull request:

    https://github.com/apache/nifi/pull/85

    New property (wrap as array) in avro2json converter

    Create a new property (wrap as array) in ConvertAvroToJson, which 
determines how stream of records is exposed: either as a sequence of single 
Objects (false), writing every Object to a new line, or as an array of Objects. 
Default value is true, meaning that the Avro content is exposed as a sequence 
of root-level Object entries. False value is useful, when you want to write 
your records as single instances to a target component (e.g. Kafka).
    
    Let's assume you have an Avro content as stream of records (record1, 
record2, ...). If wrap as array is false, the converter will expose the records 
as sequence of single JSON objects:
    ```
    record1
    record2
    ...
    recordN
    ```
    Please bear in mind, that the final output is not a valid JSON content. You 
can then forward this content e.g. to Kafka, where every record will be a 
single Kafka message.
    
    If wrap as array is true, the output looks like this:
    ```
    [record1,record2,...,recordN]
    ```
    It is useful when you want to convert your Avro content to a valid JSON 
array.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ImpressTV/nifi avro2json

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/85.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #85
    
----
commit 75dce9c1ed1018cc14562478fd83d727501700d3
Author: Joe <[email protected]>
Date:   2015-09-09T08:40:15Z

    New property (wrap as array) in avro2json converter
    
    Create a new property (wrap as array) in ConvertAvroToJson, which 
determines how stream of records is exposed: either as a sequence of single 
Objects (false), writing every Object to a new line, or as an array of Objects. 
Default value is true, meaning that the Avro content is exposed as a sequence 
of root-level Object entries. False value is useful, when you want to write 
your records as single intances to a target component (e.g. Kafka).
    
    Let's assume you have an Avro content as stream of records (record1, 
record2, ...). If wrap as array is false, the converter will expose the records 
as sequence of single JSON objects:
    
    record1
    record2
    ...
    recordN
    
    Please bear in mind, that the final output is not a valid JSON content. You 
can then forward this content e.g. to Kafka, where every record will be a 
single Kafka message.
    
    If wrap as array is true, the output looks like this:
    
    [record1,record2,...,recordN]
    
    It is useful when you want to convert your Avro content to a valid JSON 
array.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to