taoensso/nippy

decode in different language (golang)

adambl opened this issue · 2 comments

Hi,

I've recently encountered a problem decoding data that was inserted to redis with nippy encoding.
The encoding is done in clojure and I am trying to read it in golang.

I've been trying for a few hours now to reverse engineer nippy and thought I'll try asking the writers what are the steps required to read a nippy encoded string?

So, we call freeze with the data and no opts.
It seems that no opts is translated to lz4 compression, no encryption and some kind of header that I haven't figured out yet.

Can you please give a step by step breakdown (or a golang reader of nippy encoded data) of how to read nippy encoded data?

thanks

Hi Adam,

I'm afraid that Nippy isn't designed to be portable across language/platform (in your case Clojure -> Go). Portability might be possible, it just wasn't an objective of the design - and I'm not aware of any examples of libraries for decoding in other languages.

Partly because of this, the Nippy format isn't formally described anywhere; though it's pretty simple, and documented in the code itself.

I'd suggest trying to take a look at a standard format like JSON, or possibly edn or Fressian.

Hope that helps!

Another suggestion might be to look into transit as it was intended for this kind of purpose. However, there isn't an implementation in Go, but the format is well defined should someone feel adventurous enough to make an implementation in other languages.
https://github.com/cognitect/transit-format