I need to encode a Clojure byte array to JSON. I have been trying to do this using Cheshire's add-encoder function, like this:
(add-encoder [Ljava.lang.Byte encode-seq)
The problem is the reader always complains about an unmatched delimiter. I'm trying to encode something like the following:
{:bytes #<byte[] [B@9de27c>}
But this always gives me
JsonGenerationException Cannot JSON encode object of class: class [B: [B@9de27c cheshire.generate/generate (generate.clj:147)
So I'm trying to add a custom encoder. Am I even doing this the right way?