Skip to main content
Nintex Community Menu Bar
Solved

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

  • July 22, 2020
  • 2 replies
  • 155 views

WouterT
Forum|alt.badge.img+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?

Best answer by butlerj

@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.

2 replies

butlerj
Nintex Employee
Forum|alt.badge.img+20
  • Nintex Employee
  • Answer
  • July 22, 2020

@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.


WouterT
Forum|alt.badge.img+9
  • Author
  • Apprentice
  • July 23, 2020

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.