Solved

Looking for the correct syntax for the Path Expression in the Query JSON action

  • 22 July 2020
  • 2 replies
  • 62 views

Userlevel 3
Badge +9

I cannot figure out what the correct syntax should be for the path expression in the Query JSON action.

This is my sample data:

8454iE6A07D3D5E70A0D4.jpg

 

When I parse the userCreated it returns nicely John into my variable:

8451i6274A48801B64A3F.jpg

 

But this is the one I actually need: The id of the first element of mediaItems. So I use mediaItems/(0)/id:

8452i1AC0D63A2B961512.jpg

 But this returns an error:

8453i747CBAA271DE5FDC.jpg

 

Questions:

  1. What is the right syntax?
  2. Where is this explained/described?
icon

Best answer by butlerj 22 July 2020, 16:23

View original

2 replies

Userlevel 5
Badge +19

@WouterT I know that in NWC we use JSONPath syntax, and believe that the correct syntax would be: $.mediaItem[0].id.


 


I tested this on JSONPath Online (https://jsonpath.com/) and it looks to come back correctly while mediaItems/(0)/id finds no match:




 


Let me know if that works.

Userlevel 3
Badge +9

Thanks!!! Very much appreciated the time you spent to even test your solution for me. It works like a charm.
Hey Nintex, a reference link or a few basic examples in the help file or for the action would really help a lot. Even a link in the error message would have saved me a lot of time.

Reply