Groovy: Parsing JSON file

Those here from google, looking for an answer to parse JSON File.

void getItemData(String item) {
    def jsonSlurper = new JsonSlurper()
    def data = jsonSlurper.parseText(new File("data.json").text)
    println data.TESTS.each{ println it["$item"] }  
}

getItemData("MEMBER_ADDRESS")

You need to add quotes around ${item} like:

import groovy.json.*

void getItemData(String item) {
    def jsonSlurper = new JsonSlurper()
    def reader = new BufferedReader(new InputStreamReader(new FileInputStream("/tmp/json"),"UTF-8"))
    data = jsonSlurper.parse(reader)  
    data.TESTS.each { println  it."$item" }
}

getItemData("MEMBER_ADDRESS")