rails/rails — Issue #4239: Range.as_json
Author: gurgeous
Created: 2011-12-31 00:56:53+00:00
State: open

This scares me:

```ruby
>> (1..9).as_json
[1,2,3,4,5,6,7,8,9]
```

Wouldn't this be preferable?

```ruby
class Range
def as_json(options = nil)
to_s
end
end
```

This is an issue in my Rails app, where I occasionally return Ranges as JSON. If the wrong Range slips in there it could crash the app in a nasty, un-debuggable way.