CSV

Use data.csv.table to read data as TableData from CSV file. Passed path is either relative based on working dir or absolute path. Or it can be a resource class path. A B C 1 2 3 a b c def table = data.csv.table('data/table.csv') table.row(0).B.should == '2' table.row(0).B.class.canonicalName.should == 'java.lang.String' Note: by default numeric values are read as strings, to auto convert numeric values to actual numbers use tableAutoConverted method Use data.csv.tableAutoConverted to read data as TableData from CSV file. Numeric values become values of Numeric type instead of String type. Passed path is either relative based on working dir or absolute path. Or it can be a resource class path. def table = data.csv.tableAutoConverted('data/table.csv') table.row(0).B.should == 2 table.row(0).B.class.canonicalName.should == 'java.lang.Long' A B C 1 2 3 a b c Use data.csv.listOfMaps to read data as java.util.List of java.util.Map from CSV file. Passed path is either relative based on working dir or absolute path. Or it can be a resource class path. def table = data.csv.listOfMaps('data/table.csv') table.get(0).B.should == '2' table.get(0).B.class.canonicalName.should == 'java.lang.String' Note: by default numeric values are read as strings, to auto convert numeric values to actual numbers use tableAutoConverted method Use data.csv.listOfMaps to read data as java.util.List of java.util.Map from CSV file. Numeric values become values of Numeric type instead of String type. Passed path is either relative based on working dir or absolute path. Or it can be a resource class path. def table = data.csv.listOfMapsAutoConverted('data/table.csv') table.get(0).B.should == 2 table.get(0).B.class.canonicalName.should == 'java.lang.Long'

JSON

Use data.json.list to read data as java.util.List from JSON file. Passed path is either relative based on working dir or absolute path. Or it can be a resource class path. def list = data.json.list('data/flat-list.json') list[0].name.should == 'hello' list[1].payload.info.should == ~/id2 payload/ Use data.json.map to read data as java.util.Map from JSON file. Passed path is either relative based on working dir or absolute path. Or it can be a resource class path. def map = data.json.map('data/root-map.json') map.payload.info.should == "additional id1 payload"