Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to get multiple values at once from JSON file.?

avatar
Super Collaborator

Hi , i have a JSON file like below. currently i am using EvaluateJSONPath to get the filename and unique-id and updateattribute to concatenate those 2 into one filename using ${filename:append('_'):append(${unique-id})}

can i do that in EvaluateJSONPath only.? basically i want to avoid 2nd processor if it can be done.

Regards,

Sai

78637-test.jpg

5 REPLIES 5

avatar
Master Guru

Try the following as your JSONPath expression in EvaluateJSONPath:

concat($.name,"_",$.unique-id)

Expression Language is not supported in the JSONPath expressions, so if you need to use flow file attributes you'll need the additional processor to join the two attributes together as you described.

avatar
Super Collaborator
@Matt Burgess

is this what you are referring to.? this is giving filename2 as empty string.

78638-test.jpg

avatar
Master Guru

Hmm that's weird, this works for me:

77909-concat-jsonpath.png

avatar
Super Collaborator

@Matt Burgess,

hum , why wouldnt it work for me..i am running on windows..but that shouldnt stop it right.??

Regards,

Sai

avatar
Master Guru

Jeez I would hope not, I'm not aware of any platform differences for Jayway (the underlying library used to do JSONPath stuff in NiFi)