FWJSONResponseSerializer


@interface FWJSONResponseSerializer : FWHTTPResponseSerializer

FWJSONResponseSerializer is a subclass of FWHTTPResponseSerializer that validates and decodes JSON responses.

By default, FWJSONResponseSerializer 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

In RFC 7159 - Section 8.1, it states that JSON text is required to be encoded in UTF-8, UTF-16, or UTF-32, and the default encoding is UTF-8. NSJSONSerialization provides support for all the encodings listed in the specification, and recommends UTF-8 for efficiency. Using an unsupported encoding will result in serialization error. See the NSJSONSerialization documentation for more details.

  • Undocumented

    Declaration

    Objective-C

    - (instancetype)init;
  • Options for reading the response JSON data and creating the Foundation objects. For possible values, see the NSJSONSerialization documentation section “NSJSONReadingOptions”. 0 by default.

    Declaration

    Objective-C

    @property (nonatomic) NSJSONReadingOptions readingOptions;
  • Whether to remove keys with NSNull values from response JSON. Defaults to NO.

    Declaration

    Objective-C

    @property (nonatomic) BOOL removesKeysWithNullValues;
  • Creates and returns a JSON serializer with specified reading and writing options.

    Declaration

    Objective-C

    + (nonnull instancetype)serializerWithReadingOptions:
        (NSJSONReadingOptions)readingOptions;

    Parameters

    readingOptions

    The specified JSON reading options.