Solved

JSONpath implemention in NWC. How to get string length


Hi,

We have been playing a lot with JSONpaths and found that these could be applied to collections as well, which made getting items from collections a lot easier.

 

We have a need for the JSONpath function .length, but it seems that NWC doesn't support his, even though it is fully supported when trying this on https://jsonpath.com/

For example, JSON ["hi","world"] with path $.[1:2].length returns [5] on jsonpath.com (the length of the second string value), but when trying this directly in NWC and on https://us.nintex.io/tools/v1/actions/queryjson, it returns null.

I have tried this with the example from the Nintex queryjson help as well:

17768i87488D3F43F5411D.png 17769iD801DC7E42825780.png

 

Can someone please enlighten us what the difference is between the JSONpath implementation on jsonpath.com (which I believe to be generic), and the specific JSONpath implementation in NWC?

 

On a sidenote, can someone please advise how I can get the length of a string in NWC workflow (and other such functions, which are simple in .NET)?

 

Thanks!

icon

Best answer by Stefan_Scorse 21 May 2021, 02:34

View original

5 replies

In addition to the post above, it appears that JSONpath $.* doesn't work in NWC either, whilst this works fine on jsonpath.com.


Can someone please shed a light here; what JSONpath syntaxes does NWC support?


I prefer not to find out the hard way which paths don't work in NWC after testing a path on jsonpath.com.


 


Thanks


 

Hi VvK,

You can use this link check and validate your JSONPath expressionshttps://developer.nintex.com/docs/nwc-tools/reference/engine-tools.yaml/paths/~1actions~1queryjson/post

Can someone please enlighten us what the difference is between the JSONpath implementation on jsonpath.com (which I believe to be generic), and the specific JSONpath implementation in NWC?
jsonpath.com isn't a standard/generic it uses this library https://github.com/JSONPath-Plus/JSONPath  they also mention that they have extended it beyond what was originally supported.

On a sidenote, can someone please advise how I can get the length of a string in NWC workflow (and other such functions, which are simple in .NET)?
There is some more information in our help docs as well. https://help.nintex.com/en-US/nwc/Content/Designer/Actions/Queryjson.htm

Please let me know if you have any more questions.



Thanks,


Stefan

Hi Stefan,


 


Thanks for taking the time to respond and confirm that the implementation on jsonpath.com is using this Plus component, which I understand is not available in NWC.


 


Yes, I noticed that both jsonpath.com and NWC documentation point to http://goessner.net/articles/JsonPath/, but this lists a lot of features not available in NWC, which can get confusing:



 


We want to understand what is and isn't available in NWC and http://goessner.net/articles/JsonPath/ doesn't tell us this.


 


While going through https://help.nintex.com/en-US/nwc/Content/Designer/Actions/Queryjson.htm, I noticed that the wildcard is mentioned, even though this doesn't work. The documentation needs to be corrected:





 


I appreciate we can use the platform tools to speed up testing outside of NWC, but it is a bit of a hassle having to escape double-quotes for the "JSON": input in e.g. Notepad++ (see my postman screenshot above). I will however use this moving forward, since I cannot trust if my clever JSONpath will work in NWC using jsonpath.com.


 


Can you please confirm which JSONpath implementation is used in NWC, e.g. version, etc.?  We'll then look into its limitations online.


 


Thanks

Hi VvK,


 


Yes, I completely agree. I'm working with a dev team to get this documentation updated.


 


Can you please confirm which JSONpath implementation is used in NWC, e.g. version, etc.?  We'll then look into its limitations online.


We use Newtonsoft.Json version 11.0.2. 

Hope that helps. I will reply again to this thread when the documentation has been updated to reflect what we support.

Thanks, 
Stefan

Thanks Stefan, appreciate it!

Reply