Skip to content

Commit

Permalink
Update usage of :bigdecimal_as_decimal in Rails Mode (#716)
Browse files Browse the repository at this point in the history
* Update usage of :bigdecimal_as_decimal in Rails Mode

The option `:bigdecimal_as_decimal` is not available in Rails Mode (as discussed here #693), as the original JSON and Rails implementation does not have a way to "force" bigdecimal values to be encoded as numbers in json.

* Update docs for :bigdecimal_as_decimal in Rails Mode

* Use a more welcoming message
  • Loading branch information
mrbongiolo committed Oct 28, 2021
1 parent 1d219ea commit b11929b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pages/Modes.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ information.
| :float_precision | Fixnum | x | x | | | | x | |
| :hash_class | Class | | | x | x | | x | |
| :ignore | Array | | | | | x | x | |
| :indent | Integer | x | x | 3 | 4 | x | x | x |
| :indent | Integer | x | x | 4 | 4 | x | x | x |
| :indent_str | String | | | x | x | | x | |
| :integer_range | Range | x | x | x | x | x | x | x |
| :match_string | Hash | | | x | x | | x | |
| :max_nesting | Fixnum | 4 | 4 | x | | 5 | 4 | |
| :max_nesting | Fixnum | 5 | 5 | x | | 5 | 5 | |
| :mode | Symbol | - | - | - | - | - | - | |
| :nan | Symbol | | | | | | x | |
| :nilnil | Boolean | | | | | | x | |
Expand Down Expand Up @@ -141,6 +141,8 @@ information.
3. By default the bigdecimal_as decimal is not set and the default encoding
for Rails is as a string. Setting the value to true will encode a
BigDecimal as a number which breaks compatibility.
Note: after version 3.11.3 both `Oj.generate` and `JSON.generate`
will not honour this option in Rails Mode, detais on https://github.com/ohler55/oj/pull/716.

4. The integer indent value in the default options will be honored by since
the json gem expects a String type the indent in calls to 'to_json()',
Expand Down

0 comments on commit b11929b

Please sign in to comment.