title: Rendering JSON in grails
body: <p>I use the following code to render data in JSON format.</p>
  
  <pre><code>render(contentType:"text/json") {
      results = array {
          db.eachRow(query) { row -&gt;
              def rs = row.toRowResult()
              def a = b(rs.name,c,d)
              aMap.put("A",a) 
              pair(aMap)
          }
      }
      if (results) {
          status = "OK"
      }
      else {
          status ="Nothing present"
      }
  }
  </code></pre>
  
  <p>The above code generates JSON in the following format</p>
  
  <pre><code>{
      "results": [
          {"A":"value1"},
          {"A":"value2"},
          ...................
          {"A":"valuen"}
      ],
      "status":"OK"
  }
  </code></pre>
  
  <p>As u see above, the data is rendered as an <strong>array of objects</strong>. Is there a way I can render the results data as an <strong>array of elements</strong>. Like</p>
  
  <pre><code>{
      "results": [
          "value1",
          "value2",
          ...................
          "valuen"
      ],
     "status":"OK"
  }
  </code></pre>