News for hackers. Stuff that matters.
Re:Scala 3.0.0-M1 by sjrd on Wednesday November 04, 2020 @10:15AM (#24989721)
> So far the easiest JSON library has been Li Haoyi's uPickle: https://www.lihaoyi.com/post/HowtoworkwithJSONinScala.html

> Still, it does not parse JSON where objects have uknown arbitrary value types. Arbitrary value types are extremely common in real life JSON.

Looks like ujson, which the article you point to talks about, is what you're looking for. uPickle is a layer on top of ujson for statically typed stuff, but ujson is working with raw JSON values, of arbitrary types.

Re:Scala 3.0.0-M1 by sireat on Wednesday November 04, 2020 @10:36AM (#24989936)
Thank you! I will have to look into ujson deeper.
Re:Scala 3.0.0-M1 by lihaoyi on Wednesday November 04, 2020 @11:10AM (#24990273)
You can in fact mix typed and untyped parsing, by having a `ujson.Value` field in the middle of your typed case class or collection. It just works
Re:Scala 3.0.0-M1 by sireat on Thursday November 05, 2020 @08:04AM (#24997870)
Thank you Li!

`ujson.Value` is in chapter 8.1.1. of your excellent Hands-On Scala book I've bought.

Turns out for arbitrary JSON you can do this:

  val rawData = read[ujson.Value](JSONstring)
For JSON where you know most of the structure but have mixed types for object values: https://jsonplaceholder.typicode.com/todos

  val todoData = read[Seq[Map[String,ujson.Value]]](todoJSON)