Fixed JSON generation and parsing in Ruby driver.