Type Mismatch Error - Found String | Gatling version 2.2.5

Hi

i am using the below code for testing POST request to my API. I user feeder file as JSON for the same

class vertexapistep02 extends Simulation {

object getMultiLine {

val feederJson = jsonFile(“test.json”)
val headers_10 = Map(“Content-Type” → “”“application/json”"")
val multi = exec(http(“PostMultiline”)
.post("/tax_rates/v1/quotations")
.body(ElFileBody(feederJson)).asJSON
)

}

val httpConf = http
.baseURL(“https://test.core.machine”)
.acceptHeader(“application/json, /”)
.acceptCharsetHeader(“UTF-8”)
.doNotTrackHeader(“1”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.acceptEncodingHeader(“gzip, deflate”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0”)

//Setting up scenarios

val users = scenario(“MobilePOS”).exec(getMultiLine.multi)

//Simluations

setUp(
users.inject(rampUsers(10) over (10 seconds))
).protocols(httpConf)
}

I get the below error at the highlighted portion in the code:

type mismatch;

found : io.gatling.core.feeder.RecordSeqFeederBuilder[Any]

required: io.gatling.core.session.Expression[String]

(which expands to) io.gatling.core.session.Session => io.gatling.commons.validation.Validation[String]

12:21:38.198 [ERROR] i.g.c.ZincCompiler$ - .body(ElFileBody(feederJson)).asJSON

My questions are :

  1. Is it not possible to use RawFileBody or ELFileBody method when using json feeder?

Since i have a long JSON file, i would not prefer to use StringBody method ?

Any help appreciated.

Thanks,
Sunil

Update:

I have modified the code at the “.body” method and it seems ran into a different error as below:

Exception in thread “main” java.lang.IllegalArgumentException: Root element of JSON feeder file isn’t an array

Even though the error is self-explanatory, the root element of my JSON is not an array. Is there a way to use my JSON file?

Thanks,
Sunil