JSON object without "objects" property throws "TypeError: Cannot read property 'length' of null"

Should now be fixed, add unit test.
Closes issue #1235