JSON.generate(your_hash) or your_hash.to_json to convert a Ruby hash into a JSON string.JSON.parse(json_string) to convert a JSON string into a Ruby hash or array.require 'json' at the top of your Ruby file to use JSON methods.JSON.generate and JSON.dump?JSON.generate returns a JSON string from a Ruby object. JSON.dump does the same but can also write the JSON string directly to an IO object like a file.JSON.generate converts Ruby objects to JSON strings. JSON.parse does the opposite.
You must require 'json' to load the JSON library before using its methods.
JSON.parse converts JSON strings into Ruby hashes or arrays.
JSON.dump do that JSON.generate does not?JSON.dump can write JSON strings directly to files or other IO objects.
JSON.generate works with arrays and hashes to create JSON strings.
