First, thank you for any help you can provide! I've been away from coding for awhile and am having some trouble solving a problem I have with some dynamic JSON data and hoping someone can help me understand where I am stuck.
I am pulling some data in node using node-fetch and returning a JSON object with their data. Heres the structure that returns.
I need to pull the assets: # based on its sibling template id and I cannot seem to figure it out. I can pull the data if I use data.data.templates[0].assets
, but the template ID is not always going to be in the same[0] spot in the structure depending on how many templates the user has. I have checked a few posts here and thinking I may need to use JSON Expressions but I am not really getting how to make it work.
data.data.templates[templates == '210537'].assets);
feels like I am close but no cigar yet.
Can anyone point me to a post that might help me understand what I am missing!? The extra nesting is throwing me off and I am so confused at this point!
I've looked over this post json sibling data and a few others around the web but still stuck. Also it's a Node project and I am fetching the data from the web using the node-fetch module. I don't think that matters but just a little more info incase it does.