handle nested arrays and objects in the schema