Extract data from JSON with Ruby

Chef uses Ruby as the scripting language. If you need to extract data out from a JSON string you can use the following script # Save the JSON values instance_data_drive_config = ‘{“size”:”500″,”type”:”io1″,”iops”:”15000″}’ # Parse the JSON to a hash data = JSON.parse(instance_data_drive_config) # Declare the variables size = ” type = ” iops = ” …