Conforms to NSObject
Declared in RKSerialization.h

Overview

The RKSerialization protocol declares two methods that a class must implement so that it can provide support for serializing objects to and deserializing objects from UTF-8 encoded data representations of a serialization format such as JSON or XML. Serialization implementations typically handle data in a given MIME Type (i.e. application/json) and may be registered with the RKMIMETypeSerialization class.

Tasks

Deserializing an Object

  • + objectFromData:error:

    Deserializes and returns the given data in the format supported by the receiver (i.e. JSON, XML, etc) as a Foundation object representation.

    required method

Serializing an Object

  • + dataFromObject:error:

    Serializes and returns a UTF-8 encoded data representation of the given Foundation object in the format supported by the receiver (i.e. JSON, XML, etc).

    required method

Class Methods

dataFromObject:error:

+ (NSData *)dataFromObject:(id)object error:(NSError **)error
Discussion

Serializes and returns a UTF-8 encoded data representation of the given Foundation object in the format supported by the receiver (i.e. JSON, XML, etc).

Parameters

object

The object to be serialized.

error

A pointer to an NSError object.

Return Value

A data representation of the given object in UTF-8 encoding, or nil if an error occurred.

Declared In

RKSerialization.h

objectFromData:error:

+ (id)objectFromData:(NSData *)data error:(NSError **)error
Discussion

Deserializes and returns the given data in the format supported by the receiver (i.e. JSON, XML, etc) as a Foundation object representation.

Parameters

data

The UTF-8 encoded data representation of the object to be deserialized.

error

A pointer to an NSError object.

Return Value

A Foundation object from the serialized data in data, or nil if an error occurs.

Declared In

RKSerialization.h