Forum Discussion
chathurad
8 years agoContributor
I manage to write json in to a file using below code.
import net.sf.*;
import net.sf.json.*;
import net.sf.json.groovy.*;
import net.sf.json.groovy.JsonSlurper;
def Res = context.expand( '${GetAllSchoolsForAustralia#Response}' )
def slurper = new JsonSlurper()
def json = slurper.parseText Res
def countryList = json.result._source.city
log.info countryList
def file = new File('D:/XXX/CityListAU.txt');
// save the response to it
file << countryList