Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

multidimensional array result return parse

ANSWERED

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.

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

newValue contains a JSON string, so you need to JSON.parse(evt.data.newValue) before trying to access its values.

View best answer in original post

Best Answer
0 Votes
2 REPLIES 2

newValue contains a JSON string, so you need to JSON.parse(evt.data.newValue) before trying to access its values.

Best Answer
0 Votes

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
0 Votes