Write_file_with_write.rb

This content was produced by an LLM and could include errors.

This script requires the JSON library. It converts a simple Ruby hash into a structured JSON string and successfully writes the data to a specified file.

require 'json'
#=> true

hash = {:key => 'value'}
#=> {key: "value"}

File.write('input/json/file.json', JSON.dump(hash))
#=> 15

Ruby 4.0.3