Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

SplitJSON JSONPath Expression from database record

SplitJSON JSONPath Expression from database record

New Contributor

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!
1 REPLY 1

Re: SplitJSON JSONPath Expression from database record

Super Guru

Hi @Bill Duncan,
input to splitjson processor is an array, you need to use JsonpathExpression as $.* property in splitjson processor.
it will splits Json array to individual records, use split relationship to get the individual records.

Properties of Splijson Processor:-

38535-splitjson.png

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

Output:-
would be 3 flowfiles because our input array having 3 individual records
{"provider_study_id": 1001}
{"provider_study_id": 1002}
{"provider_study_id": 1003}

Don't have an account?
Coming from Hortonworks? Activate your account here