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.
this does more than just decode. "transfer"?