handle nested arrays for complex objects