david4dev's answer to this question claims that there are three equivalent ways to convert an object to a JSON string using the json
library:
JSON.dump(object)JSON.generate(object)object.to_json
and two equivalent ways to convert a JSON string to an object:
JSON.load(string)JSON.parse(string)
But looking at the source code, each of them seems to be pretty much different, and there are some differences between them (e.g., 1).
What are the differences among them? When to use which?