Forum Discussion
1 Reply
- forkbatteryOccasional Contributor
I figured out the following to read file using JsonSlurper. I'm able to print each JSON document with the help of 'each' as seen in the code below. I can't figure out how I would pass each of the documents into the request of a test case. I'd really appreciate if anyone could tell me how this can be done!
import groovy.json.* File f = new File('C:\\contacts.txt') def slurper = new JsonSlurper() def jsonText = f.getText() json = slurper.parseText( jsonText ) json.each{ log.info it }