I am converting some JSON files to msgpack with this code:
File.open("example.msgpack", 'wb') do |output_file|
Oj.load_file("example.log") do |json|
msgpack = MessagePack.pack(json)
output_file.write(msgpack)
end
end
The problem is that I get this error:
/ruby/gems/3.2.0/gems/msgpack-1.7.1/lib/msgpack.rb:41:in `write': undefined method `to_msgpack' for 0.12818649802057203e0:BigDecimal (NoMethodError)
packer.write v
Is there any solution to this problem?
How would you convert a normal JSON lines file to msgpack?
(I don't mind if BigDecimal is rounded to a lower precision)