I am currently working on rendering JSON data using jsRender. Take a look at the sample JSON data below:
"PageContentList": [
{
"ContentId": 51,
"Title": "60 seconds with Rick",
"ContentMediaTypeList": [
{
"MimeType": "image/png",
"MediaTypeName": "Image",
"Path": "http://local.admin.solutiaconsulting.com/uploads/4a906d8e-983a-4b54-a627-0e8d48145620.png"
},
{
"MimeType": "video/webm",
"MediaTypeName": "Video",
"Path": "http://local.admin.solutiaconsulting.com/uploads/3a6c56c3-0ef9-4f57-9c84-9caa48a09044.webm"
}
]
}
]
My goal is to extract different images based on MediaTypeName rather than their position in the list. I am aware of the following methods:
{{:ContentMediaTypeList[1].Path}}
and this:
{{for ContentMediaTypeList}} {{if MediaTypeName == 'Video'}} {{:Path}} {{/if}} {{/for}}
However, the second method feels cumbersome and inefficient. Is there a more efficient way to achieve what I'm trying to do? Thank you for any guidance you can provide.