backport exception for invalid JSONKeyPathsByPropertyKey

This ports a part of #325 back to master, to address #331.
Can this be `self.JSONKeyPathsByPropertyKey` as well?