fork download
  1. def accountPrefix = '265954'
  2. def jsonString = '''[
  3. {
  4. "part": 1,
  5. "set": 265,
  6. "ifsc": "88977",
  7. "value": "569954F3365220210621"
  8. },
  9. {
  10. "part": 2,
  11. "set": 266,
  12. "ifsc": "88978",
  13. "value": "965954F3365220210621"
  14. },
  15. {
  16. "part": 3,
  17. "set": 267,
  18. "ifsc": "88979",
  19. "value": "265954F3365220210621"
  20. }
  21. ]'''
  22. def json = new groovy.json.JsonSlurper().parseText(jsonString)
  23. def accountNumber = json.find {it.value.startsWith(accountPrefix)}.value
  24. println "Account Number fetched: ${accountNumber}"
  25. assert '265954F3365220210621' == accountNumber, 'Test failed'
Success #stdin #stdout 1.56s 140768KB
stdin
Standard input is empty
stdout
Account Number fetched: 265954F3365220210621