Prior json format
This MR allows prior dicts (and prior classes) to be read from/written to json.
It's not the prettiest code so style feedback is particularly welcome.
This will allow to store all prior types, relevant to #355 (closed), #192 (closed).
Also, if we make this the default and deprecate the current version, we can remove the eval
statement in the prior reading.