[ 
https://issues.apache.org/jira/browse/NIFI-844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14703450#comment-14703450
 ] 

Mark Payne commented on NIFI-844:
---------------------------------

Sean,

The GenericData.toString(Object) does have JavaDocs indicating that it will 
convert the record into JSON. I realize now, after your comment, that I updated 
the code in only one place to use this - in one place the patch uses 
GenericData.toString(Object) and in the other place it uses 
GenericRecord.toString() - I will update to replace GenericRecord.toString() to 
use the GenericData.toString(Object), since it is documented.

I certainly believe that a processor to convert between two Avro schemas is 
useful, and that's actually mentioned as #3 of the "First-class Avro Support" 
Feature proposal 
(https://cwiki.apache.org/confluence/display/NIFI/First-class+Avro+Support).

What I'm looking for here is a JSON document that has exactly the same 
hierarchy as the associated Avro record. The specific use-case that I have in 
mind is when using ExecuteSQL, the results of the query are output as an Avro 
record(s). I want to then convert that into a JSON record that is essentially 
key/value pairs.

So if I have a database that has a table named PERSONS that has two columns: ID 
and NAME, and i do a "SELECT ID as id, NAME AS name FROM PERSONS" I want a JSON 
record to come back in the form:

{code}
{
  "id": 8,
  "name": "Mark Payne"
}
{code}

I *think* what you are suggesting will result in far more complicated JSON that 
does not match this schema, no?

> Create Processor to convert Avro to JSON
> ----------------------------------------
>
>                 Key: NIFI-844
>                 URL: https://issues.apache.org/jira/browse/NIFI-844
>             Project: Apache NiFi
>          Issue Type: Task
>          Components: Extensions
>            Reporter: Mark Payne
>            Assignee: Mark Payne
>             Fix For: 0.3.0
>
>         Attachments: 
> 0001-NIFI-844-Initial-import-of-ConvertAvroToJSON-process.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to