Heads up: This description was created by AI and might not be 100% accurate.

write_file_with_write.rb

This Ruby code snippet demonstrates loading the json library, creating a hash with a key-value pair, and then writing that hash to a JSON file named file.json in the input/json/ directory.

Ruby code snippet

require 'json'
#=> true

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

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

Executed with Ruby 3.4.5.