Support Questions

Find answers, ask questions, and share your expertise
Announcements
Welcome to the upgraded Community! Read this blog to see What’s New!

NiFi HTTP JSON parsing (EvaluateJsonpath)

avatar
New Contributor

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. 


Cy Jervis, Manager, Community Program
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

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?

Labels