Reputation: 449
There is following JSON structure given:
"filter": {
"1": {
"value": "swiss"
},
"2": {
"value": "google"
}
}
How to access the variable "value" via an index variable within a gsp template like this?
<g:each in="${...}" var="data" status="i">
${filter?.i?.value}
</g:each>
Upvotes: 0
Views: 360
Reputation: 571
Is that what you are looking for? It's without index variable.
<g:each in="${filter}" var="data" status="i">
${data.value.value}
</g:each>
Upvotes: 0
Reputation: 37073
If your "key" there is a variable you can use a GString notation like for any other property referenced by variable:
${filter?."$i"?.value}
Upvotes: 1