Iterate through JSON array in GSP

tylerclark50

New member
I have following JSON response

{"tips":{"count":185,"items":[{"id":"4d72c60d75bcba7a163a70bc","text":"the bacon served with the southern breakfast is significantly different from the other bacons. this is my fav in NYC.","createdAt":1299367437,"done":{"count":1},"todo":{"count":0},"user":{"id":"30792","lastName":"T.","bio":"","homeCity":"Los Angeles, CA","canonicalUrl":"https://foursquare.com/sarah_tay","gender":"female","firstName":"Sarah","photo":"https://is1.4sqi.net/userpix_thumbs/GLOA4QOXGINN1RVC.jpg"}},{"id":"4d7257cd27ddb60c7e5ccc1b","text":"Arrive before 1030 on weekends, or don't bother going...","createdAt":1299339213,"done":{"count":1},"todo":{"count":1},"user":{"id":"1022550","lastName":"K.","bio":"","homeCity":"New York, NY","canonicalUrl":"https://foursquare.com/thedjk","gender":"male","firstName":"Daniel","photo":"https://is0.4sqi.net/userpix_thumbs/1AQVRYZETFBDM3C0.jpg"}},{"id":"4d684656b6f46dcb631e11b2","text":"There was a line forming by 8:30 on a Friday morning. Blueberry pancakes were yum.","createdAt":1298679382,"done":{"count":1},"todo":{"count":1},"user":{"id":"3395676","lastName":"y.","bio":"","homeCity":"New York, NY","canonicalUrl":"https://foursquare.com/ettay","gender":"female","firstName":"etta","photo":"https://is1.4sqi.net/userpix_thumbs/


Cannot display the text in gsp although count is getting displayed, whats wrong in below code?

<g:if test="${result}">


<h3>${result.tips.count}</h3>
</g:if>
<ul>
<g:each in="${result.items}">
<li>${it.createdAt}</li>
li>${it.text}</li>

</g:each>
</ul>
 
Top