пытается сделать ниже, но, получая overloaded method value differences with alternatives: cannot be applied to java.util.Map[String, Any]
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.google.common.collect.Maps
import scala.collection.JavaConverters._
object Testing extends App {
val leftJson = """{
"name": {
"first": "John",
"last": "Doe"
},
"address": null,
"birthday": "1980-01-01",
"company": "Acme",
"occupation": "Software engineer",
"phones": [
{
"number": "000000000",
"type": "home"
},
{
"number": "999999999",
"type": "mobile"
}
]
}"""
val rightJson = """{
"name": {
"first": "Jane",
"last": "Doe",
"nickname": "Jenny"
},
"birthday": "1990-01-01",
"occupation": null,
"phones": [
{
"number": "111111111",
"type": "mobile"
}
],
"favorite": true,
"groups": [
"close-friends",
"gym"
]
}"""
val mapper = new ObjectMapper
mapper.registerModule(DefaultScalaModule)
val leftMap = mapper.readValue(leftJson, classOf[Map[String, Any]])
val rightMap = mapper.readValue(rightJson, classOf[Map[String, Any]])
val differences = Maps.difference(leftMap.asJava, rightMap.asJava)
}
Error:(59, 26) overloaded method value difference with alternatives:
[K, V](x$1: java.util.SortedMap[K, _ <: V], x$2: java.util.Map[_ <: K, _ <: V])com.google.common.collect.SortedMapDifference[K,V] <and>
[K, V](x$1: java.util.Map[_ <: K, _ <: V], x$2: java.util.Map[_ <: K, _ <: V], x$3: com.google.common.base.Equivalence[_ >: V])com.google.common.collect.MapDifference[K,V] <and>
[K, V](x$1: java.util.Map[_ <: K, _ <: V], x$2: java.util.Map[_ <: K, _ <: V])com.google.common.collect.MapDifference[K,V]
cannot be applied to (java.util.Map[String,Object], java.util.Map[String,Object])
val differences = Maps.difference(leftMap.asJava, rightMap.asJava)