abstract class Object
Overview
Object
is the base type of all Crystal objects.
Direct Known Subclasses
Defined in:
nason/any.crnason/null.cr
nason/to_json.cr
Class Method Summary
-
.from_nason(string_or_io, root : String)
Deserializes the given NASON in string_or_io into an instance of
self
, assuming the NASON consists of an NASON object with key root, and whose value is the value to deserialize. -
.from_nason(string_or_io)
Deserializes the given NASON in string_or_io into an instance of
self
.
Instance Method Summary
- #===(other : NASON::Any)
- #nil_or_null?
- #not_null!
- #null?
- #to_nason(io : IO) : Nil
- #to_nason : String
- #to_pretty_json(indent : String = " ") : String
- #to_pretty_json(io : IO, indent : String = " ") : Nil
Class Method Detail
Deserializes the given NASON in string_or_io into
an instance of self
, assuming the NASON consists
of an NASON object with key root, and whose value is
the value to deserialize.
Int32.from_nason(%({"main": 1}), root: "main") # => 1
def self.from_nason(string_or_io)
#
Deserializes the given NASON in string_or_io into
an instance of self
. This simply creates a parser = NASON::PullParser
and invokes new(parser)
: classes that want to provide NASON
deserialization must provide an def initialize(parser : NASON::PullParser)
method.
Int32.from_nason("1") # => 1
Array(Int32).from_nason("[1, 2, 3]") # => [1, 2, 3]