oj
oj copied to clipboard
Optimized JSON
Originally, I have encountered this problem when I tried to dump and load [`Faraday::Header` object](https://github.com/lostisland/faraday/blob/fcb2003178dc362888d5ccf16bfb776a4aa16f46/lib/faraday/utils/headers.rb#L102) in Oj's default mode. Reproduction (same applies to `Array` and `String` subclasses): ```ruby require 'oj'...
JSON: ``` > JSON.parse(Oj.generate(":asdf")) => ":asdf" ``` Oj: ``` > Oj.load(Oj.generate(":asdf")) => :asdf ``` Is this intentional? I don't see an option for changing this behaviour. I am using version...
According to https://github.com/ohler55/oj/blob/v3.10.6/pages/Modes.md, the `:rails` mode should support the `space` formatting option. However, this does not seem to work when using a `StringWriter`; only some of the options given below...
`Oj` ignores `to_json `methods defined on a class and encodes as it normally would without any `to_json` method being defined. ``` require 'json' require 'oj' class Klass def self.to_json(*) 'correct_result'...
I have a system that streams a very large newline oriented JSON into a multiple line chunks and then puts those multiline chunks into a `SizedQueue` which is then processed...
Hi, Since I upgraded to Oj 3.11.4 (from 3.11.2) json serialization of rails models don't work as expected. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" git_source(:github) {...
Since [Ruby 3.0 sockets are by default nonblocking](https://bugs.ruby-lang.org/issues/17664), which causes issues for `Oj.to_stream` [here](https://github.com/ohler55/oj/blob/7b9a95f2f07046c766b8bdb26829763d1b700578/ext/oj/dump.c#L690) ```ruby require "oj" require "socket" require 'io/nonblock' pid = spawn("nc -d 0.1 -l 5000", out: "/dev/null")...
Hello Please take a look at code below, for some reason `mode` before calling `Oj.generate` is `:object` but it becomes `:compat`afterwards (other options change as well). I assume it's not...
Hi @ohler55, thanks for your amazing work on Oj! I found an "issue" in the way `BigDecimal` is handled when upgrading from v3.11.3 to v3.11.4 when using `JSON.generate`. It's a...
👋 I'll say up front that this was difficult to narrow down, and I'm still not certain of the root cause. It's unclear to me whether it's ultimately on the...