title: Ruby output numbers to 2 decimal places
body: <p>I'm having trouble serializing my ruby object to json, more specifically the format of the numbers.
  I have written an rspec test to illustrate my issue more precisely.</p>
  
  <pre><code>expected = '{ "foo": 1.00, "bar": 4.50, "abc": 0.00, "xyz": 1.23 }'
  
  it 'serializes as expected' do
    my_hash = { "foo": 1, "bar": 4.5, "abc": 0, "xyz": 1.23}
    expect(my_to_json_method(my_hash)).to eq expected
  end 
  </code></pre>
  
  <p>This is the case that I am having trouble with. I can use the sprintf but how do I get the string output as shown in the above example?</p>