Get keyword label/value pairs and store them to map

Depending on how you use keywords, the following code may be helpful. It gets all the label/value pairs of a keyword and stores them to a map. It was a bit tricky to get the label/pairs into a map, so I’m posting the code:

#set($keyword_choices = $rx.keyword.keywordChoices("My_Keyword"))
#set($map = $rx.string.stringToMap("a=b"))
$map.clear()
#foreach($choice in $keyword_choices)
#set($keyword_pair_as_list = $user.psoListTools.asList($choice))
#set($dummy_for_map = $map.put($keyword_pair_as_list.get(0),$keyword_pair_as_list.get(1)))
#end