Improve/fix JSON deserialization
This merge request moves the inverse dicts from the JSON deserialization to _generic.py, since they are used in the XML deserializaton as well.
It also makes _construct_reference() return its object_class parameter, as mentioned on zulip nearly two months ago. :'D
Edited by Michael Thies