Make array/object parsing more robust