SmartModule for processing json record using jq syntax. We use rust version of jq to process JSON data.
You can use the jaq playground to test Jq expression.
fluvio hub smartmodule download infinyon/jaq@0.1.0
download connector:
cdk hub download infinyon/http-source@0.3.8
Have connector.yaml file like this cat.yaml
apiVersion: 0.1.0
meta:
version: 0.3.8
name: cat-facts-transformed
type: http-source
topic: cat-facts-data-transform
http:
endpoint: https://catfact.ninja/fact
interval: 10s
transforms:
- uses: infinyon/jaq@0.1.0
with:
filter: ".fact"
To get a simple fruit:
smdk test --file test-data/fruit-input.json --raw -e filter=.fruit
{"name":"apple","color":"green","price":1.2}
With pipeline:
smdk test --file test-data/creatures-input.json --raw -e filter=".[] | .name"
["Sammy","Bubbles","Splish","Splash"]