Answer the question
In order to leave comments, you need to log in
BigDecimal + as_json() = String?
Hello. It's best to do it in as_json() with BigDecimal in String.
and then I get the following result
{"count_plan"=>#BigDecimal:a639408,'0.2E1',9(18)}
Answer the question
In order to leave comments, you need to log in
This is the case when pretty-printing objects in Ruby, useful for debugging.
And to serialize to JSON, a string should be used myobj.to_json
.
h = {b: BigDecimal.new('12.34'), s: 'string'}
puts h.to_json
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question