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 use instanceof, so this doesn't fail for subclasses of the expected class.