Sha256: 61746a12e6e39e1b7a8d90503e96c0de7672c3ada85fb437c769379f820ad0ac

Contents?: true

Size: 1.2 KB

Versions: 136

Compression:

Stored size: 1.2 KB

Contents

# Custom mode

The `:custom` mode is the most configurable mode and honors almost all
options. It provides the most flexibility although it can not be configured to
be exactly like any of the other modes. Each mode has some special aspect that
makes it unique. For example, the `:object` mode has it's own unique format
for object dumping and loading. The `:compat` mode mimic the json gem
including methods called for encoding and inconsistencies between
`JSON.dump()`, `JSON.generate()`, and `JSON()`.

The `:custom` mode is the default mode. It can be configured either by passing
options to the `Oj.dump()` and `Oj.load()` methods or by modifying the default
options.

The ability to create objects from JSON object elements is supported and
considers the `:create_additions` option. Special treatment is given to the
`:create_id` though. If the `:create_id` is set to `"^o"` then the Oj internal
encoding and decoding is used. These are more efficient than calling out to a
`to_json` method or `create_json` method on the classes. Those method do not
have to exist for the `"^o"` behavior to be utilized. Any other `:create_id`
value behaves similar to the json gem by calling `to_json` and `create_json`
as appropriate.

Version data entries

136 entries across 136 versions & 3 rubygems

Version Path
oj-3.10.12 pages/Custom.md
oj-3.10.11 pages/Custom.md
oj-3.10.10 pages/Custom.md
oj-3.10.9 pages/Custom.md
oj-3.10.8 pages/Custom.md
oj-3.10.7 pages/Custom.md
oj-3.10.6 pages/Custom.md
oj-3.10.5 pages/Custom.md
oj-3.10.3 pages/Custom.md
oj-3.10.2 pages/Custom.md
oj-3.10.1 pages/Custom.md
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/oj-3.10.0/pages/Custom.md
oj-3.10.0 pages/Custom.md
oj-3.9.2 pages/Custom.md
oj-3.9.1 pages/Custom.md
oj-3.9.0 pages/Custom.md
oj-3.8.1 pages/Custom.md
oj-3.8.0 pages/Custom.md
oj-3.7.12 pages/Custom.md
oj-3.7.11 pages/Custom.md