jsonata-rs 0.3.4

An (incomplete) implementation of JSONata in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
    "expr": "\n        (\n          $tempReadings := $count(state.tempReadings) = 5 ?\n              [state.tempReadings[[1..4]], event.t] :\n              [state.tempReadings, event.t];\n        \n          {\n            \"tempReadings\": $tempReadings,\n            \"sumTemperatures\": $sum($tempReadings),\n            \"avgTemperature\": $average($tempReadings) ~> $round(2),\n            \"maxTemperature\": $max($tempReadings),\n            \"minTemperature\": $min($tempReadings)\n          }\n        )",
    "dataset": "dataset18",
    "bindings": {},
    "result": {
        "tempReadings": [
            28.9,
            28,
            28.2,
            28.4,
            28.4
        ],
        "sumTemperatures": 141.9,
        "avgTemperature": 28.38,
        "maxTemperature": 28.9,
        "minTemperature": 28
    }
}