class Symbol
def as_json(*)
Symbol.json_create(x) # => :foo
\Method +JSON.create+ deserializes such a hash, returning a \Symbol object:
# => {"json_class"=>"Symbol", "s"=>"foo"}
x = :foo.as_json
require 'json/add/symbol'
returning a 2-element hash representing +self+:
\Method Symbol#as_json serializes +self+,
see Marshal[https://docs.ruby-lang.org/en/master/Marshal.html].
to serialize and deserialize a \Symbol object;
Methods Symbol#as_json and +Symbol.json_create+ may be used
def as_json(*) { JSON.create_id => self.class.name, 's' => to_s, } end