Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json Array to be used in Homeyscript #52

Open
chrisboer opened this issue Dec 8, 2023 · 1 comment
Open

Json Array to be used in Homeyscript #52

chrisboer opened this issue Dec 8, 2023 · 1 comment

Comments

@chrisboer
Copy link

It would be nice to get the "Result" from a previous flowcard to be used in a script.

For example

// Your JSON array as a string
var jsonString = Resultaat;

// Parse the JSON string into a JavaScript array of objects
var dataArray = JSON.parse(jsonString);

// Extract the value associated with "Etdy_ge1" from the dictionary at index 17
var valueAtIndex17 = null;
if (dataArray.length > 17 && dataArray[17].key === "Etdy_ge1") {
valueAtIndex17 = dataArray[17].value;
}

// Parse the value into a number (assuming it's a string representation of a float)
var parsedValue = valueAtIndex17 !== null ? parseFloat(valueAtIndex17) : null;

// Print or use the parsed value as needed
console.log("Parsed Value:", parsedValue);

@jeroenwienk
Copy link
Contributor

It would be nice to get the "Result" from a previous flowcard to be used in a script.

For example

// Your JSON array as a string var jsonString = Resultaat;

// Parse the JSON string into a JavaScript array of objects var dataArray = JSON.parse(jsonString);

// Extract the value associated with "Etdy_ge1" from the dictionary at index 17 var valueAtIndex17 = null; if (dataArray.length > 17 && dataArray[17].key === "Etdy_ge1") { valueAtIndex17 = dataArray[17].value; }

// Parse the value into a number (assuming it's a string representation of a float) var parsedValue = valueAtIndex17 !== null ? parseFloat(valueAtIndex17) : null;

// Print or use the parsed value as needed console.log("Parsed Value:", parsedValue);

You can do this with Advanced Flows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants