This example returns the same result from three endpoints, each one using a
different technique to extract the expandedBom array from a large backend
response (data/bom.json) and return it as a collection:
| Endpoint | Technique |
|---|---|
/using-lua |
A Lua script (filter.lua) deletes the unwanted keys, and mapping renames expandedBom to collection |
/using-jmespath |
A JMESPath expression expandedBom[*] |
/using-allow |
The backend allow list keeps only expandedBom, and mapping renames it |
All three use "output_encoding": "json-collection" to return the array as
the root of the response.
You need a KrakenD Enterprise license, because JMESPath is an Enterprise
feature. Replace the placeholder LICENSE file in this folder with yours, and
start the stack:
docker compose upThen compare the three responses:
curl http://localhost:8080/using-lua
curl http://localhost:8080/using-jmespath
curl http://localhost:8080/using-allow