module Rome::Serialization

Direct including types

Defined in:

serialization.cr

Constructors

Instance Method Summary

Constructor Detail

def self.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))

[View source]

Instance Method Detail

def 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)

[View source]
def to_json(io : IO, indent = nil) : Nil #

Exports the record as JSON, including all attributes and the extra attributes loaded from the database.


[View source]
def to_json(builder : JSON::Builder) : JSON::Builder #

Exports the record as JSON, including all attributes and the extra attributes loaded from the database.


[View source]
def to_json(indent = nil) : String #

Exports the record as JSON, including all attributes and the extra attributes loaded from the database.


[View source]