// test.scala
@main def test(): Unit =
println(os.read(os.pwd/"data"/"test.json"))
println(ujson.read(os.read(os.pwd/"data"/"test.json")))
Test Data
{"id": 6821264719157920773}
Result
Multiple main classes detected. Select one to run:
[1] hello
[2] test
Enter number: 2
[info] running test
{"id": 6821264719157920773}
{"id":6821264719157920768}
[success] Total time: 7 s, completed 2024年3月21日 下午8:59:00
This is expected. ujson follows the Javascript data model, including 64-bit floating point numbers only. If you want to parse Longs or other data types, you want upickle.default.read[Map[String, Long]](...)
Dependencies
libraryDependencies += "com.lihaoyi" %% "os-lib" % "0.9.3", libraryDependencies += "com.lihaoyi" %% "upickle" % "3.2.0"
Test Code
Test Data
Result
Environment