Support Questions

Find answers, ask questions, and share your expertise

Nifi JsonSplit Doesn't Work

avatar

Hi

I'am using splitjson for splitting json.

After that i am using convertJsonToSql and putsql but nifi only puts last json part of the splitted jsons. I want to insert all parts.

Do you have any idea why i can't do that. Thanks.

6725-template.png

6726-splitjsonconf.png

source json:

 {
  "endorsement" : 59.9,
  "eventId" : "c54902db-50de-4dbd-b908-4317981931fc",
  "categoryId" : "1000230",
  "createDate" : "2016-08-18T10:15:00.361Z",
  "buyerId" : "4748764",
  "channel" : "MOBILE_IOS",
  "city" : "Bursa"
}, {
  "endorsement" : 13.11,
  "eventId" : "c54902db-50de-4dbd-b908-4317981931fc",
  "categoryId" : "1000491",
  "createDate" : "2016-08-18T10:15:00.361Z",
  "buyerId" : "4748764",
  "channel" : "MOBILE_IOS",
  "city" : "Bursa"
} ]

after split json there are two jsons:

6757-splitted.png


source.png6756source.png
1 ACCEPTED SOLUTION

avatar

i found the problem.

Reason was the hbase, i am sending same values as key so, it is impossible. After changing key values, everything working fine.

Thanks

View solution in original post

6 REPLIES 6

avatar
Master Guru

Can you provide an example JSON document that is not splitting correctly?

avatar
Expert Contributor

Could you provide an example of the json you're trying to split, and what is in some of the resulting flowfiles after the SplitJson processor? I suspect that the JsonPath being used might not be splitting the json the way you want.

avatar

Splitting is done correctly. I am watching al the processes till Last process.putsql processes passes insert sql statements according to data provenance.

But still last json part as a record is inserted all the time.

avatar
Master Guru

ConvertJSONtoSQL expects the JSON object (to be converted to an INSERT/UPDATE statement) to be in the flow file content, not the attributes. Between your SplitJson and your ConvertJSONtoSQL you have a couple of processors like EvaluateJsonPath and AttributesToJSON. What is your configuration for AttributesToJSON? What does that last UpdateAttribute processor do before it goes to ConvertJSONtoSQL? If you could share a template (perhaps a scrubbed version to remove your server-specific information?) that would be helpful as well.

avatar

because of the attachment limit i continue with this message:

two splitted json:

6761-part1.png

6762-part2.png

two putsql queryy:

6764-putsql1.png

6765-putsql2.png

avatar

i found the problem.

Reason was the hbase, i am sending same values as key so, it is impossible. After changing key values, everything working fine.

Thanks