Answers for "ruby read json to file"

2

ruby read json file

require "json"
json_from_file = File.read("myfile.json")
hash = JSON.parse(json_from_file)
Posted by: Guest on May-14-2020
0

ruby write json to file

require 'json'
File.open("filename.json", "w") do |f|
  f.write(JSON.pretty_generate(my_hash))
end
Posted by: Guest on March-11-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language