toJSON now supports arrays.