JSON export/import

Implementation is fairly stupid (encoders/decoders could easily be
autogenerated from a list of fields per data type) and does not have
enough tests, but should be good enough to play around with.
Please split the Decoder interface from the utility methods and use composition to re-use the utilities.