Last active
October 27, 2020 20:00
-
-
Save sureshnath/78c65b59be73c3409979b3572c8e5518 to your computer and use it in GitHub Desktop.
using groovy playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.JsonSlurper | |
def jsonSlurper = new JsonSlurper() | |
def object = jsonSlurper.parseText( | |
'{"count":20,"teams":[{"id":322,"name":"Hull City FC","shortName":"Hull","squadMarketValue":null,"crestUrl":"http://upload.wikimedia.org/wikipedia/de/a/a9/Hull_City_AFC.svg"},{"id":338,"name":"Leicester City FC","shortName":"Foxes","squadMarketValue":null,"crestUrl":"http://upload.wikimedia.org/wikipedia/en/6/63/Leicester02.png"},{"id":340,"name":"Southampton FC","shortName":"Southampton","squadMarketValue":null,"crestUrl":"http://upload.wikimedia.org/wikipedia/de/c/c9/FC_Southampton.svg"}]}' | |
) | |
def allTeamNames = object.teams.name | |
def namesWithCity = object.teams.findAll {it.name =~ /City/}.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment