LCJSONRequestSerializer

Objective-C

@interface LCJSONRequestSerializer : LCHTTPRequestSerializer

Swift

class LCJSONRequestSerializer : LCHTTPRequestSerializer

LCJSONRequestSerializer is a subclass of LCHTTPRequestSerializer that encodes parameters as JSON using NSJSONSerialization, setting the Content-Type of the encoded request to application/json.

  • Options for writing the request JSON data from Foundation objects. For possible values, see the NSJSONSerialization documentation section “NSJSONWritingOptions”. 0 by default.

    Declaration

    Objective-C

    @property (nonatomic) NSJSONWritingOptions writingOptions;

    Swift

    var writingOptions: JSONSerialization.WritingOptions { get set }
  • Creates and returns a JSON serializer with specified reading and writing options.

    Declaration

    Objective-C

    + (nonnull instancetype)serializerWithWritingOptions:
        (NSJSONWritingOptions)writingOptions;

    Swift

    convenience init(writingOptions: JSONSerialization.WritingOptions = [])

    Parameters

    writingOptions

    The specified JSON writing options.