ambiguous reference to overloaded definition error for Jackson.parse

Hi,

I would like to compare JSON response with expected output using following solution:

`

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.core.json.Jackson
import java.nio.charset.StandardCharsets.UTF_8
import scala.concurrent.duration._

class BasicSimulation extends Simulation {
lazy val expectedJson = Jackson.parse(
getClass.getResourceAsStream("/output.json"),
UTF_8
)

val scn = scenario(“Scenario Name”)
.exec(http(“request_1”)
.get(“http://localhost:8000/output.json”)
.check(bodyString.transform(Jackson.parse).is(expectedJson))
)

setUp(scn.inject(atOnceUsers(1)))
}

`
However, it doesn’t work for me, I receive following error:

`

error: ambiguous reference to overloaded definition,
both method parse in object Jackson of type (stream: java.io.InputStream, charset: java.nio.charset.Charset)Object
and method parse in object Jackson of type (string: String)Object
match expected type ?
bodyString.transform(Jackson.parse).is(defaultTeam))
^

`

Here’s a content of JSON response:

[{"id":777}]

N.B. I don’t want to use jsonPath here. Please advice.

transform is overloaded too (see transform), so Scala type system can’t infer which Jackson.parse overload to pick. You have to explicitly set the parameter types instead of using method lifting.

Beware that the Jackson object you’re trying to use is for internal usage and can change without further notice.