JSON: encode BigDecimal NaN/Infinity as null. #6096

merged 1 commit into from May 1, 2012

3 participants


This is an addendum to #2532

Adds the same to_json behaviour to BigDecimal NaN and +/-Infinity.

  {'nan' => BigDecimal(0.0)/(0.0) }.to_json
  # => { 'nan' : null }
Ruby on Rails member

@drogus I think you've merged the other patch he refers to, could you take a look at this as well?

Ruby on Rails member

@carlosantoniodasilva sure, it looks ok :)

@drogus drogus merged commit ec94d84 into rails:master May 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment