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
Right now there is no protocol that can convert to/from Seq[Any] and Map[String, Any]. This prevents spray-json from being used in many scenarios, unless you code up your own protocol. Spray-json should provide out of the box protocols for these common generics.
I have code that I would like to contribute back for these protocols.
The text was updated successfully, but these errors were encountered:
Isn't the only thing you would need to provide is a JsonFormat[Any] to support both of the other ones? The reason there is no such format accessible by default is that effectively you turn off type-safety with such a format. Apart from that it is hard (or even generally impossible) to provide because Any is unbounded and you can never know which types a user of the library would use the format with in front. So, as it stands this is a 'won't fix'.
I guess you have a more concrete usecase in mind than the fully general case where we or you could provide a solution?
I'm not asking for supporting the open ended case, just all the standard JSON types. The use case is for general JSON-based events, so the fields can be strings, numbers, bools, floats/doubles. The format can change so just using case classes isn't a good fit, and type safety doesn't matter anyways as the field values of the events themselves are opaque to my app.
Generic map/list support (with the types mentioned above) is already implemented by most other JSON libraries -- definitely in JSON4S, as well as Jacks. I honestly have considered switching to the other libraries because out of the box usability is much better for my use case.
I already have working code, not quite sure how to attach it. I simply use a pattern match for the type comparison, although I can use something more efficient (lookup table possibly...)
Right now there is no protocol that can convert to/from Seq[Any] and Map[String, Any]. This prevents spray-json from being used in many scenarios, unless you code up your own protocol. Spray-json should provide out of the box protocols for these common generics.
I have code that I would like to contribute back for these protocols.
The text was updated successfully, but these errors were encountered: