https://discord.gg/botpress logo
Hi! I have a question
# 💻developers
h
Hi! I have a question Its is possible to store an object to an array variable:
Copy code
try {
        const response = await axios.get(apiUrl, { headers });
        if (response.data && Array.isArray(response.data.data)) {
            const responseData = response.data.data;
            workflow.branches = responseData.map((branch) => ({ [branch.id]: branch.name }));
        } else {
            console.error('Error with response:', response.data);
        }
    } catch (error) {
        console.error('HTTP Error:', error);
    }
And then that array variable use it as choices? so i save the value and not the label? Thx!
As far as i've tried i get error, idk if there is a workarround or something