JSONata is a powerful query language that can be used to operate on JSON data. Namely, it has a very rich feature library that would lend itself well to be used on Bento message data.
Motivation
JSONata is syntax is extremely powerful and lends itself very well to JSON data.
There is already a rich feature set for operating on numeric, array, string, boolean data types as well as datetime-based processing.
Create a JSONata processor component (similar to the jq processor) that can operate on Bento message data. The blues/jsonata-go library seems like the best option here.
Optional stretch goal: If possible, it could be useful to create some connection between JSONata and Bloblang such that we can call JSONata functions in bloblang.
Note: JSONata does not mutate JSON data, instead creating new JSON objects.
Context
JSONata is a powerful query language that can be used to operate on JSON data. Namely, it has a very rich feature library that would lend itself well to be used on Bento message data.
Motivation
Task
Create a JSONata processor component (similar to the jq processor) that can operate on Bento message data. The blues/jsonata-go library seems like the best option here.
In addition, this component should:
$error
](https://docs.jsonata.org/object-functions#error) is thrown.Note: JSONata does not mutate JSON data, instead creating new JSON objects.
Example usage
Flatten a deeply nested array:
FInd the total cost of orders:
Reverse and reduce a list of JSON objects:
Sum the
items
array and return a new reduced object:Get all cities in WA: