You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Bill Duncan <wd...@gmail.com> on 2017/04/14 14:43:37 UTC

SplitJSON JSONPath Expression

Hi All,

I am working on extracting records on from a MySQL database and converting
the records to RDF. My processor workflow looks like this:

ExecuteSQL --> ConvetAvroToJSON --> SplitJSON

So far, I've managed to connect to the DB, and convert it to Avro. However,
I am failing on the spit step. I can't seem to get the JSONPath Expression
right.

The JSON data looks like this:

[{"provider_study_id": 1001},
 {"provider_study_id": 1002},
 {"provider_study_id": 1003}]

But, I can't seem to get the path expression correct to split the data.
I've tried:

${provider_study_id}
${"provider_study_id"}
[${"provider_study_id"}]
$.{"provider_study_id"}

The error message say the element cannot be found ...

Thanks for any help!

Bill

Re: SplitJSON JSONPath Expression

Posted by James Wing <jv...@gmail.com>.
Bill,

I think the JSON path expression you are looking for is just

$

Which is a reference to the root object array.  This should result in three
splits like {"provider_study_id":1001}

Thanks,

James

On Fri, Apr 14, 2017 at 7:43 AM, Bill Duncan <wd...@gmail.com> wrote:

> Hi All,
>
> I am working on extracting records on from a MySQL database and converting
> the records to RDF. My processor workflow looks like this:
>
> ExecuteSQL --> ConvetAvroToJSON --> SplitJSON
>
> So far, I've managed to connect to the DB, and convert it to Avro.
> However, I am failing on the spit step. I can't seem to get the JSONPath
> Expression right.
>
> The JSON data looks like this:
>
> [{"provider_study_id": 1001},
>  {"provider_study_id": 1002},
>  {"provider_study_id": 1003}]
>
> But, I can't seem to get the path expression correct to split the data.
> I've tried:
>
> ${provider_study_id}
> ${"provider_study_id"}
> [${"provider_study_id"}]
> $.{"provider_study_id"}
>
> The error message say the element cannot be found ...
>
> Thanks for any help!
>
> Bill
>
>
>