Inherits from AFHTTPResponseSerializer : NSObject
Declared in AFURLResponseSerialization.h
AFURLResponseSerialization.m

Overview

AFJSONResponseSerializer is a subclass of AFHTTPResponseSerializer that validates and decodes JSON responses.

By default, AFJSONResponseSerializer accepts the following MIME types, which includes the official standard, application/json, as well as other commonly-used types:

  • application/json
  • text/json
  • text/javascript

Properties

readingOptions

Options for reading the response JSON data and creating the Foundation objects. For possible values, see the NSJSONSerialization documentation section “NSJSONReadingOptions”. 0 by default.

@property (nonatomic, assign) NSJSONReadingOptions readingOptions

Declared In

AFURLResponseSerialization.h

Class Methods

serializer

Creates and returns a serializer with default configuration.

+ (instancetype)serializer

Declared In

AFURLResponseSerialization.h

serializerWithReadingOptions:

Creates and returns a JSON serializer with specified reading and writing options.

+ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions

Parameters

readingOptions

The specified JSON reading options.

Declared In

AFURLResponseSerialization.h

Instance Methods

responseObjectForResponse:data:error:

- (id)responseObjectForResponse:(NSURLResponse *)response data:(NSData *)data error:(NSError *__autoreleasing *)error

Declared In

AFURLResponseSerialization.h