Build the json from ruby hashes