import fs from 'fs' import axios from 'axios' let config = JSON.parse(fs.readFileSync('config.json', 'utf8')) axios.get(`http://${config.servers.deconz.url}:${config.servers.deconz.apiPort}/api/${config.servers.deconz.apiKey}/sensors`) .then(response => { console.log(response.data) fs.writeFileSync('devices.json', JSON.stringify(response.data, null, 2)) })