dakrone / cheshire

Clojure JSON and JSON SMILE (binary json format) encoding/decoding
https://github.com/dakrone/cheshire
MIT License
1.49k stars 151 forks source link

Serializable predicate #118

Open martinklepsch opened 7 years ago

martinklepsch commented 7 years ago

To clean up data before serializing it it would be nice to have some kind of predicate if Cheshire will be able to turn x into JSON. I looked at cheshire.generate but it seems not every thing implements the JSONable protocol but instead there is this big cond handling the polymorphism.

@dakrone do you have any thoughts on this and maybe an idea how you'd like to see it implemented - if at all? :)

dakrone commented 7 years ago

I don't really have any input for how this would be implemented, the only requirement would be to keep the same performance characteristics that cheshire currently has.

Perhaps the cond could be made into a macro that could be used within both the generation and serializable check?