backport exception for invalid JSONKeyPathsByPropertyKey

This ports a part of #325 back to master, to address #331.