Update content/resources/how-to-guides/reduce-to-construct-JSON.md
parent
b010101987
commit
31e9823c69
|
@ -11,7 +11,7 @@ weight: 105
|
|||
## Send data in JSON body with `http.post()`
|
||||
Use the [reduce()](/flux/v0.x/stdlib/universe/reduce/) function to create a JSON object to include as the body with `http.post()`.
|
||||
|
||||
1. Boilerplate. Import packages. The [array](/flux/v0.x/stdlib/array/) package is used to construct tables so you can run this script yourself. The [http package](/flux/v0.x/stdlib/http/) is used to transfer the JSON over http.
|
||||
1. Import both the [array](/flux/v0.x/stdlib/array/) package to query data and contruct table(s), and the [http package](/flux/v0.x/stdlib/http/) to transfer JSON over http.
|
||||
2. Use `array.from()` to query data and construct a table. Or, use another method [to query data with Flux](/influxdb/v2.3/query-data/flux/).
|
||||
3. Use the `reduce()` function to start constructing a JSON. The output of reduce is stored in the result `output of reduce`. This table looks like:
|
||||
|
||||
|
|
Loading…
Reference in New Issue