title: Groovy - JsonSlurper Parsing JSON file
body: <p>I have a JSON document structured similar to below, and I am trying to parse it in Groovy.  Basically for each School (School Info), I want to grab the <code>SCHOOL_COUNTRY</code> and other fields.  I am trying this code below but it is not returning what I need.  For each school listed (1,000's), I want to grab only specific parts, for instance:</p>
  
  <pre><code>def parseJSON(long id) {
  
      JSONFile fileInstance = JSONFile.get(id)
      def json = new JsonSlurper().setType(RELAX).parse(new FileReader(fileInstance.filePath))
      def schoolInfo = json.SCHOOL_INFO
      def schoolName = json.SCHOOL_INFO.SCHOOL_NAME
      schoolInfo.each {
         render(schoolInfo.SCHOOL_NAME)
      }
  }
  </code></pre>
  
  <p>So basically for each school, just print out the name of the school. The JSON structure:</p>
  
  <pre><code>[{
      "SCHOOL_INFO": {
          "SCHOOL_COUNTRY": "Finland",   
          "SCHOOL NAME": "Findland Higher Learning"              
       },
       "LOCATION": {                  
           "LONGITUDE": "24.999",                   
           "LATITUDE": "61.001"
       }
  }]
  </code></pre>