nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Burgess <>
Subject Re: JSON handling question
Date Mon, 13 May 2019 22:20:18 GMT

AFAIK we don't have a way to convert a string field to a JSON object
outside of something like an ExecuteScript processor. You can use
QueryRecord to do a "SELECT C FROM FLOWFILE" or a ConvertRecord
processor with a writer that only includes the C field (the rest will
be removed), but the result will be a JSON string inside quotes. From
there you can use ExecuteScript with something like Groovy that can
take a string and parse a JSON object from it.  You could try a
FreeFormRecordSetWriter but I still think the quotes come with the
string field.

With the advent of schema inference, we should take a look at
something like an "asJSON()" function in QueryRecord which could infer
the schema of the JSON object and merge that record schema into the
overall outgoing record schema. Alternatively (or additionally) maybe
we could add a ConvertField processor to do something similar.


On Mon, May 13, 2019 at 5:11 PM Eric Ladner <> wrote:
> (sorry if this is duplicated but it didn't like my work email address).
> I have an instance where I'm pulling data via the QueryDatabaseTable processor and one
of the columns contains a valid JSON string that I'd like to split out into a separate flowfile
to be handled separately.  I can't seem to find a way to peel it out into its own entity,
> As an example, "select A, B, C from some_table" returns rows of data where the text value
in column "C" is valid JSON.  In a standard "SplitAvro -> AvroToJson" flow, $.C would be
the JSON value from the select.  I just can't figure out how to promote the value of an attribute
in the query to its own flowfile.
> I'm probably missing something simple, but any tips would be appreciated.
> --
> Eric Ladner

View raw message