Rome::Serialization
Constructors
new(pull : JSON::PullParser) : self
Initializes a record from a JSON parser. This considers the record to be
a new record and not persisted. See #attributes=(JSON::PullParser) to
update a persisted record.
user = User.new(JSON::PullParser(string_or_io))
Instance methods
attributes=(pull : JSON::PullParser) : Nil
Sets many attributes at once from a JSON parser. For example:
user = User.find(1)
user.attributes = JSON::PullParser.new(string_or_io)
to_json(io : IO, indent = nil) : Nil
Exports the record as JSON, including all attributes and the extra attributes loaded from the database.
to_json(builder : JSON::Builder) : JSON::Builder
Exports the record as JSON, including all attributes and the extra attributes loaded from the database.
to_json(indent = nil) : String
Exports the record as JSON, including all attributes and the extra attributes loaded from the database.