Hi,
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:”)
println(s.getClass)
println("")
}
I see:
returned scala type is:
class com.fasterxml.jackson.databind.node.ObjectNode
If I then copy https://github.com/gatling/gatling/blob/master/gatling-core/src/main/scala/io/gatling/core/json/Json.scala 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?
Thanks,
Tom