You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In sbt:
"org.json4s" %% "json4s-jackson" % "4.0.4"
scala version
2.12.15
jdk version
JDK8
When I learnt to use json4s to read a json file "file.json".
importorg.json4s._importorg.json4s.jackson.JsonMethods._traitDataReader {
defreadData():List[Person]
defreadDataInefficiently():List[Person]
}
classDataReaderImplextendsDataReader {
implicitvalformats=DefaultFormatsprivatedefreadUntimed():List[Person] =
parse(StreamInput(getClass.getResourceAsStream("file.json"))).extract[List[Person]]
overridedefreadData():List[Person] = readUntimed()
overridedefreadDataInefficiently():List[Person] = {
(1 to 10000).foreach(_ =>
readUntimed())
readUntimed()
}
}
objectDataReaderExample {
defmain(args: Array[String]):Unit= {
valdataReader=newDataReaderImpl
println(s"I just read the following data efficiently:${dataReader.readData()}")
println(s"I just read the following data inefficiently:${dataReader.readDataInefficiently()}")
}
}
It cannot compile correctly, and throw:
could not find implicit value for evidence parameter of type org.json4s.AsJsonInput[org.json4s.StreamInput]
Error occurred in an application involving default arguments.
parse(StreamInput(getClass.getResourceAsStream("file.json"))).extract[List[Person]]
when I change json4s version in 3.6.0-M2 in sbt:
"org.json4s" %% "json4s-jackson" % "3.6.0-M2"
It gose well. Why would this happen? How should I fix it in 4.0.4?
Thank you for your Help.
The text was updated successfully, but these errors were encountered:
json4s version
In sbt:
"org.json4s" %% "json4s-jackson" % "4.0.4"
scala version
2.12.15
jdk version
JDK8
When I learnt to use json4s to read a json file "file.json".
It cannot compile correctly, and throw:
when I change json4s version in 3.6.0-M2 in sbt:
It gose well. Why would this happen? How should I fix it in 4.0.4?
Thank you for your Help.
The text was updated successfully, but these errors were encountered: