Closed lihaoyi closed 2 months ago
Oh yes, please! The lack of serialization of a not existing option to nothing is what prevents me from using upickle as my general-purpose json lib.
If you want to use upickle to expose an http API serving json, the expectation is that for a missing option, you can just drop the field.
Because that is how most APIs work in the real world. For that reason I default to using Play Json for APIs currently.
Currently we serialize them as
k: [v]
ork: []
, which is generally not what people want. We should instead serialize them ask: v
or nothing.Nested options could probably continue to be serialized boxed in a single-element array. Options in sequences and other things that serialize to arrays can conitnue to be boxed as well.
This would be a breaking change and would need to go into upickle 4.0.0