Closed kikonen closed 1 year ago
hmm...
p Oj.default_options
{:indent=>0, :second_precision=>3, :circular=>false, :class_cache=>true, :auto_define=>false, :symbol_keys=>false, :bigdecimal_as_decimal=>nil, :create_additions=>false, :use_to_json=>false, :use_to_hash=>false, :use_as_json=>false, :use_raw_json=>false, :nilnil=>false, :empty_string=>true, :allow_gc=>true, :quirks_mode=>true, :allow_invalid_unicode=>false, :allow_nan=>true, :trace=>false, :safe=>false, :float_precision=>16, :cache_str=>0, :ignore_under=>false, :cache_keys=>true, :mode=>:object, :integer_range=>nil, :escape_mode=>:json, :time_format=>:unix, :bigdecimal_load=>:auto, :compat_bigdecimal=>false, :create_id=>"json_class", :space=>nil, :space_before=>nil, :object_nl=>nil, :array_nl=>nil, :nan=>:auto, :omit_nil=>false, :hash_class=>nil, :array_class=>nil, :ignore=>nil}
so default mode is "object", not "compat" like I've expected
However,
Oj.default_options = {
mode: :compat,
}
does not seem to fix it
I guess my workaround is to not to add_json for Date/Time cases
I.e. just add other cases
Oj.add_to_json(Array, BigDecimal, Complex, Exception, Hash, Integer, OpenStruct, Range, Rational, Regexp, Struct)
I think that approach is exactly right.
Can this be closed?
"Oj.add_to_json" resolved problem
Have been trying different options, and seems that
causes output to be inapproriate.
Q: What flags should be toggled to get proper output.
config used: