Gatling 3.03 Json.asScala returning Jackson ObjectNode, not scala Map


I am having an issue converting a Jackson ObjectNode back to a scala map using io.gatling.core.json.Json.asScala(). For the simple simulation below:

class JsonQuery extends Simulation {

private val jsonData = “”"
“Item1” : “Value1”,
“Item2” : “Value2”,
“TrueItem” : true,
“FalseItem” : false

val mapper = new ObjectMapper()
val actualObj = mapper.readTree(jsonData)

val s = io.gatling.core.json.Json.asScala(actualObj)
//val s = MyJson.asScala(actualObj)

println(“returned scala type is:”)

I see:

returned scala type is:
class com.fasterxml.jackson.databind.node.ObjectNode

If I then copy into my project, rename Json to MyJson, and switch to using the commented line above instead, I get:

returned scala type is:
class scala.collection.immutable.Map$Map4

which is what I would expect. It is as if the builtin Json.asScala is returning what I pass it, or something (though I haven’t checked).

Am I doing something wrong or is this a bug in 3.03?


Indeed, you are doing something wrong: io.gatling.core.json.Json is not a public API, it’s an internal and you shouldn’t be using it.

Implementation is different in 3.1.3 and in master (upcoming 3.2.0).

Fair enough - it’s not in the api documentation so I guess I was overreaching. I’ve only started using scala due to gatling and wasn’t sure of the best way to integrate/make use of Json support.

At least from this I’ve learned that Jackson is already available so I’ll just work with that.

Thanks for everything you’ve done with gatling - it’s awesome!

Thanks for your kind words and your understanding.

Generally speaking, everything that’s not documented is an internal we might change without further notice, even if we didn’t make it private or final.

Have fun!