Skip to main content
JeffTheMilkMan
Bronze ⭐️⭐️⭐️
May 20, 2023
Question

NiFi HTTP JSON parsing (EvaluateJsonpath)

Hey there,

I need some help with configuring EvaluateJsonpath because I'm having trouble with it. Everything else seems to be working fine, but I always get stuck at this part. I've tried looking for solutions online, but none of them seem to work or they're just outdated. It's possible that I messed up something in the other function blocks, but they still work if I remove the EvaluateJsonpath. Any ideas?

 

JeffTheMilkMan_0-1684583849958.pngJeffTheMilkMan_1-1684583877358.png

 

This is the json file:

{
"random": 3171504720,
"als": 29024,
"mic": 47334,
"gyro": {
"x": -26,
"y": 8,
"z": 1
},
"accel": {
"x": -1829,
"y": 447,
"z": 16802
}
}

 

2 replies

cjervis
Community Manager
Community Manager
May 22, 2023

Welcome to the community @JeffTheMilkMan. While you wait for a more knowledgeable response, I'll provide a link to  Parsing XML Logs With Nifi – Part 1 of 3 in case it can be of assistance. 

Translate
Keep the questions coming
ChuckE
Gold ⭐️
May 22, 2023

What you are doing is mostly correct.  I see a couple of items that may be creating some issues, e.g. mis-assigned values.

 

For example, you are assigning accel.x to all three attributes values ax, ay, az.  But it seems like you probably meant to assign ax = $.accel.x , ay =$.accel.y , az =$.accel.z

 

It seems you've mixed up "random" and "rand".  The field name in your JSON is "random" so your attribute assignment should be rand = $.random

 

Where is "btn" in your JSON?

Translate