Last group in asset listing keyword


(Grant) #1

Matrix Version:5.5.2.2

Hello,

Just wondering if theres a similar keyword to “%asset_is_last%” but for groups, this one doesn’t seem to work the same? I’m printing JSON and need to check if its the last group to not print a ‘,’.

Is there any other ways this could be achieved if a keyword doesn’t exist.

Cheers,
Grant


(Lisa) #2

Hi Grant,

I’ve not found any keyword for that, but in the same situation I’ve added “{}” to the asset listing’s Page Contents, so it will always add an empty object at the end resulting in valid JSON. It’s not ideal, but it works.

e.g.
[%asset_listing%{}]

Hope that helps!
Lisa


(Ton Handgraaf) #3

Hi Grant,
You could remove the comma at the end with the replace keyword modifier:
[%asset_listing^replace:,$:%]

Regards,
Ton