Sha256: 26541aa29220d6f495c0ba12dabc6a9b1366564d218eb269efed461fe97380ba

Contents?: true

Size: 522 Bytes

Versions: 53

Compression:

Stored size: 522 Bytes

Contents

# frozen_string_literal: true

require 'oj'

extras = {"locationLng" => -97.14690769100295}

Oj.default_options = {float_precision: 17}

encoded = Oj.dump(extras)
puts encoded
puts Oj.load(encoded)

require "active_record"

Oj::Rails.set_encoder()
Oj::Rails.set_decoder()

Oj.default_options = {float_precision: 17}
# Using Oj rails encoder, gets the correct value: {"locationLng":-97.14690769100295}
encoded = ActiveSupport::JSON.encode(extras)
puts encoded
puts ActiveSupport::JSON.decode(encoded)
puts Oj.load(encoded)

Version data entries

53 entries across 53 versions & 2 rubygems

Version Path
oj-3.14.3 test/prec.rb
devcycle-ruby-server-sdk-2.0.0 vendor/bundle/ruby/3.0.0/gems/oj-3.13.2/test/prec.rb
oj-3.14.2 test/prec.rb
oj-3.14.1 test/prec.rb
oj-3.14.0 test/prec.rb
oj-3.13.23 test/prec.rb
oj-3.13.22 test/prec.rb
oj-3.13.21 test/prec.rb
oj-3.13.20 test/prec.rb
oj-3.13.19 test/prec.rb
oj-3.13.18 test/prec.rb
oj-3.13.17 test/prec.rb
oj-3.13.16 test/prec.rb
oj-3.13.15 test/prec.rb
oj-3.13.14 test/prec.rb
oj-3.13.13 test/prec.rb
oj-3.13.12 test/prec.rb
oj-3.13.11 test/prec.rb
oj-3.13.10 test/prec.rb
oj-3.13.9 test/prec.rb