Method: Kernel#JSON
- Defined in:
- lib/gems/json_pure-1.1.3/lib/json/common.rb
#JSON(object, opts = {}) ⇒ Object
If object is string-like parse the string and return the parsed result as a Ruby data structure. Otherwise generate a JSON text from the Ruby data structure object and return it.
The opts argument is passed through to generate/parse respectively, see generate and parse for their documentation.
337 338 339 340 341 342 343 |
# File 'lib/gems/json_pure-1.1.3/lib/json/common.rb', line 337 def JSON(object, opts = {}) if object.respond_to? :to_str JSON.parse(object.to_str, opts) else JSON.generate(object, opts) end end |