agrostar / zzapi-vscode

VS Code extension for zzapi - an API testing and documentation framework
MIT License
3 stars 0 forks source link

Advanced array indexing tricks like ThunderClient #8

Closed vasan-agrostar closed 1 month ago

vasan-agrostar commented 1 month ago

Forked off from issue #3

vasan-agrostar commented 1 month ago

The ThunderClient array indexing tricks all have JSONPATH equivalents. Since we don't evaluate the path within zzAPI ourselves and rely only on jsonpath, we can only support what jsonpath does.

Take, for example, this ThunderClient example:

json.items[type$="Food"].type

Using JSON path, this is what you would do to achieve the same:

$.items[?(@.type.endsWith('Food'))].type
gitblit commented 1 month ago

Thanks for this information. 💪 I'll read more about JSONPath.

vasan-agrostar commented 1 month ago

Resources you may find useful:

  1. https://jsonpath.com/
  2. https://goessner.net/articles/JsonPath/index.html#e2