Handle deeply-nested lists and maps appropriately for serialization