Reading JSON file and sending content using ElFileBody to a method.

Hello experts,

I am new to Scala and Gatling, I am trying to write framework for Load and performance testing using Gatling API in Scala for REST API endpoints.
I have a query regarding one of the code snippet which is supposed to generate signature(calling another method) and save the value in the session.

.exec(session => {
session.set(“sign”, SignatureGeneration.getSignature(key, ElFileBody(“abc.json”).toString()))

abc.json -
{“device”: “${device}”}

In above code getSignature takes arguments (String, String).
I want to read the json file and replace ${} value in it with the feeders and send it as String to the method.

While debugging the code I found out, ElFileBody send object as and not the json content of it.

Please help me in getting this done as its really urgent for my project.

Solution -

val bodyExpr = ElFileBody("trip.json")
val bodyStr = bodyExpr(session).get