improve input validation for objects and object arrays

afaik we could cast to Map[] here, so we'll save the 2nd cast later on