Ensure that the key in require is valid.

A proof of concept of ensuring that the key returned from require is valid. Can use from refactoring if this is a feature we want to accept.

This is to get around a NoMethod exception raised by valid JSON, but invalid input as explained in issue #140