user7047891 user7047891 - 11 months ago 64
Groovy Question

How to iterate below json in grails gsp page to get each correspondance label and value


Answer Source

You have to parse it in the server-side:

// Parse the JSON
def list = new JsonSlurper().parseText(jsonString)

Then send it to your gsp and iterate as a regular map

<g:each in="${list}">
    <p>Label: ${it.label}</p>
    <p>Value: ${it.value}</p>