Skip to content
instance method

Set#to_json

(?::JSON::State? state) -> ::String
to_json(*args)

Returns a JSON string representing self:

Example
require 'json/add/set'
puts Set.new(%w/foo bar baz/).to_json

Output:

Example
{"json_class":"Set","a":["foo","bar","baz"]}
See also #to_a #to_s #superset? #to_set also in 3.4 · 3.3 · 3.2 · 3.1 · 3.0