Table - Can't Access Nested Object

Hello,

I have a table with a column, feedback, containing the following data where I am trying to only display comments in the cell:

[
{"comments":"I left out the previous bag but no one picked it up.  Order was delivered to the wrong house but my neighbors thankfully dropped off the meals to us.",
"time":"2023-01-22T19:35:34.270Z",
"recipient":"Dude Number 1",
"rating":3}]

I’ve managed to do this properly for many other columns, but for some reason I can’t get this working. I’ve tried:

{{currentRow.feedback[0]["comments"]}}
{{currentRow.feedback[0].comments}}
{{currentRow["feedback"][0].comments}}
{{currentRow["feedback"][0]["comments"]}}

Not sure what I’m doing wrong, but the evaluated data is good up-until it’s time for comments. What am I doing wrong!?

Hello! Can you please share this app with us to debug this scenario? Add support@appsmith.com as a Developer and send us the link to the app.

Sent PM.

Thanks, @Amelia !

Thank you. The value is not shown because, for some of the entries, the comments property does not exist. Please use optional chaining and it should work: {{currentRow.feedback[0]?.comments}}

1 Like

@Amelia You’re a lifesaver! I guess I should probably learn Javascript, huh? :face_with_spiral_eyes:

1 Like