On Thu, Dec 8, 2016 at 11:31 PM, Andy Jones <Andy.Jones / jameshall.co.uk> wrote:
> I'm aware that it's documented.  I said it was *annoying*.  Which is a different thing ;)

i see : )
you can chose bw generate and to_json, depending on use case.

.. snippet from the manual..
#--------------------------------------
JSON.generate only allows objects or arrays to be converted to JSON
syntax. to_json, however, accepts many Ruby classes even though it acts
only as a method for serialization:

  require 'json'

  1.to_json => "1"
#---------------------------------------

> JSON.generate 'foo'
JSON::GeneratorError: only generation of JSON objects or arrays allowed

best regards
--botp

Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>