Class: JsonRpcObjects::Serializer::JSON

Inherits:
JsonRpcObjects::Serializer show all
Defined in:
lib/json-rpc-objects/serializer/json.rb

Overview

JSON serializer using multi_json.

Instance Method Summary collapse

Instance Method Details

#deserialize(data) ⇒ Object

Deserializes data.

Parameters:

  • data (Object)

    data in serialized form

Returns:

  • (Object)

    deserialized data



44
45
46
# File 'lib/json-rpc-objects/serializer/json.rb', line 44

def deserialize(data)
    MultiJson.decode(data)
end

#serialize(data) ⇒ Object

Serializes data.

Parameters:

  • data (Object)

    some data

Returns:

  • (Object)

    object in serialized form



33
34
35
# File 'lib/json-rpc-objects/serializer/json.rb', line 33

def serialize(data)
    MultiJson.encode(data)
end