Skip to main content



Groovy Script for reading json file and post to REST API Request in SOAPUI

//Import groovy JSON
import groovy.json.*

//Read the JOSN File and parse the json arrays
def fileContent = new File('C:\\Office\\records_JSON.json').text
def json = new JsonSlurper().parseText(fileContent)

//opening new file for storing the REST API Response.
File file = new File("C:\\Office\\Response.txt")

//Count the number of records
def lt = json.size()

//Preparing the list of arrays
//def forgivnessMap = [:]
def forgivnessDataMap = [:]

//Loop to POST Forgivness request for number of records
for (i = 0; i <lt; i++)

//Mapping the array values to the vaiables
def amt = json[i].amount
def div = json[i].division

//Mapping varaibles to the LIST MAP

//Eliminate the mapping of divisionnumber if its is NULL
if(div != null)

//Preapring the JSON Payload for forgivness
def ForgivnessPayload = new JsonBuilder(forgivn…

Latest Posts

My pom.xml file for Selenium TestNG Maven Project for referance

Best Practices for RestFul API's design

Scrum Meetings

Some use full links for Scrum Process learning:-

My MongoDB Commands Notes