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.

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

Highlighted

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

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

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

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.

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

Super Collaborator
@Matt Burgess

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

78638-test.jpg

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

Hmm that's weird, this works for me:

77909-concat-jsonpath.png

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

Super Collaborator

@Matt Burgess,

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

Regards,

Sai

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

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)