Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

NiFi HTTP JSON parsing (EvaluateJsonpath)

avatar

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 2

avatar
Community Manager

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. 

Keep the questions coming

avatar
Expert Contributor

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?