improve input validation for objects and object arrays

added that to the test below, see ``testInsertNestedObjectLiteral()``