Module: SerialBox::Serializers::JSON::ClassMethods

Defined in:
lib/serializers/json.rb

Instance Method Summary collapse

Instance Method Details

#json_create(object) ⇒ Object

Converts a primitive object (deserialized from JSON) into an instance of this class.

Note: You should not call this method directly. You should use ‘JSON.parse` to ensure recursive deserialization works properly.

Parameters:

  • object (Array, Hash)

    The JSON-ready primitive represnetation of an instance of this class.

Returns:

  • An instance of this class derived from the JSON.



55
56
57
58
59
60
61
# File 'lib/serializers/json.rb', line 55

def json_create(object)
  instance = allocate
  _serialbox_serializer.deserialization_operations.each do |operation|
    operation.apply instance, object
  end
  return instance
end