I have a data with Map Structure. I want to iterate on the data and extract a list of keys with special values. I wrote the below code:
val jsonString = os.read(os.pwd/"src"/"main"/"scala"/"config.json")
val data = ujson.read(jsonString)
for ((k,v) <- data) println(s"key: $k, value: $v")
But when I run it, received this error:
Can not resolve foreach symbol
Also, when I wrote run
in sbt shell
; it show me this error:
[error] /home/spark/scala_project/test/src/main/scala/main.scala:99:17: value withFilter is not a member of ujson.Value.Value
[error] for ((k,v) <- data) println(s"key: $k, value: $v")
[error] ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
I added this dependency to build.sbt. But, it did n't solve the problem.
libraryDependencies += "com.foreach.across" % "across-core" % "5.1.3.RELEASE"
Would you please guide me how to solve the issue?
Any help is really appreciated.