Trying to parse return result from Select that includes TextImageRow render. Used JSON.stringify(evt) to produce return result. {"data":{"key":"emblem","newValue":"{\"selected\":[0],\"values\":[{\"id\":\"0\",\"image\":\"my-image-end.png\",\"name\":\"Fleet\"}]}"}} I am needing the Id from the values of the selected newValue.
Answered! Go to the Best Answer.
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
newValue contains a JSON string, so you need to JSON.parse(evt.data.newValue) before trying to access its values.
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
I ended up using the below after several attempts to get the id field value from:
{"data":{"key":"emblem","newValue":"{\"selected\":[0],\"values\":[{\"id\":\"0\",\"image\":\"my-image-end.png\",\"name\":\"Fleet\"}]}"}}
let data = JSON.parse(evt.data.newValue);
result = data['values'][0]['id'];
Best Answer