Move nestedObjs definition out of forEach. gh-693