JSONata:提取 min/max 温度,包括时间戳

JSONata: Extract min/max temperature including timestamp

我们有这个JSON数据

[{"time":"2020-05-18T19:09:53.000Z","Temperatur":24.1},{"time":"2020-05-18T19:09:58.000Z","Temperatur":24},{"time":"2020-05-18T19:12:48.000Z","Temperatur":23.9},{"time":"2020-05-18T19:13:27.000Z","Temperatur":24},{"time":"2020-05-18T19:13:33.000Z","Temperatur":23.9},{"time":"2020-05-18T19:13:48.000Z","Temperatur":24},{"time":"2020-05-18T19:13:55.000Z","Temperatur":23.9},{"time":"2020-05-18T19:16:33.000Z","Temperatur":23.8},{"time":"2020-05-18T19:17:46.000Z","Temperatur":23.9},{"time":"2020-05-18T19:18:26.000Z","Temperatur":23.8},{"time":"2020-05-18T19:19:12.000Z","Temperatur":23.8},{"time":"2020-05-18T19:21:07.000Z","Temperatur":23.9},{"time":"2020-05-18T19:21:13.000Z","Temperatur":23.8},{"time":"2020-05-18T19:24:32.000Z","Temperatur":23.7},{"time":"2020-05-18T19:24:51.000Z","Temperatur":23.8},{"time":"2020-05-18T19:25:50.000Z","Temperatur":23.7},{"time":"2020-05-18T19:29:19.000Z","Temperatur":23.7},{"time":"2020-05-18T19:29:25.000Z","Temperatur":23.7},{"time":"2020-05-18T19:29:35.000Z","Temperatur":23.8},{"time":"2020-05-18T19:29:42.000Z","Temperatur":23.7},{"time":"2020-05-18T19:29:48.000Z","Temperatur":23.7},{"time":"2020-05-18T19:32:47.000Z","Temperatur":23.6},{"time":"2020-05-18T19:35:00.000Z","Temperatur":23.7},{"time":"2020-05-18T19:35:06.000Z","Temperatur":23.6},{"time":"2020-05-18T19:36:07.000Z","Temperatur":23.5},{"time":"2020-05-18T19:36:19.000Z","Temperatur":23.6},{"time":"2020-05-18T19:39:22.000Z","Temperatur":23.5}]

使用 $max(Temperatur) 可以轻松获得最高温度。但是如何提取对应的时间戳呢?

您可以通过降低温度对数组进行排序,然后select数组中的第一项:

$^(>Temperatur)[0].time

参见:https://try.jsonata.org/Q5e7wFAz4