Wrote an EDN format reader and writer in Python

I was reading about the EDN format over the weekend. EDN (pronounced like in “eden garden”) is a data format in the same league as JSON but is supposed to have some nifty features such as sets, keywords, date-time type, custom types, and also being a proper subset of Clojure.

Having a date-time type as well as custom types seems useful to me, so I was taking a look at the current Python implementations of the EDN format and I didn’t find them satisfactory, for example, one of the listed ones had all custom parsing code which was difficult to read, one was not even a real implementation, just boilerplate code, etc.

So I thought why not create a better implementation and I did – it is up on GitHub at https://github.com/swaroopch/edn_format.

It has been a long time since I did lex and yacc, so it was a fun weekend project :)

Published by swaroop


2 thoughts on “Wrote an EDN format reader and writer in Python

  1. Since 2003-2004 you can use the “eden” format (ECMAScript Data Exchange Notation) to serialize or deserialize your objects : http://code.google.com/p/edenrr/wiki/edenFeatures

    eden is a serializer/deserializer library using a subset of the ECMAScript notation, it allows to exchange and interpret data keeping the structure and the type.

    The choice to define the “edn_format” is not a big mistake ?

    1. @ekameleon I have not previously heard about the “eden” that you mentioned – but it doesn’t seem to be a data format, more like a subset of JavaScript – I mean, it can do function calls! Comparatively, this EDN format seems to be simpler to me.

      Nevertheless, people create formats, protocols, and technologies to solve their need, and from that perspective, EDN is a good thing, not a mistake :)

Comments are closed.