How To Make Rails Json Output Decimal Numbers Instead Of Strings

Working on an application I noticed that when getting JSON data from Rails the decimal numbers come as strings. Turns out this is to ensure it is still accurately rounded.If you don’t care about the rounding of large numbers then you can force Rails to output the decimals as numbers.


How To Make Rails Json Output Decimal Numbers Instead Of Strings #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/how-to-make-rails-json-output-decimal-numbers-instead-of-strings

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles