Saturday, 6 May 2017

NodeJs: convert array of objects to a big object

i want to write points to InfluxDB. Refer to https://docs.influxdata.com/influxdb/v1.2/introduction/

The fields of the point are array of objects:

[ { water: 8.12 }, { temp: 22.05 }, { humid: 60.04 } ]

how can this array be converted to an object of the format

 { water: 8.12 ,  temp: 22.05 ,  humid: 60.04 } 

as required by this package https://github.com/vicanso/influxdb-nodejs ? Thanks in advance.



via Thanh

No comments:

Post a Comment