Skip to content

FoveaCentral/JSONObject

Repository files navigation

JSONObject

Lightweight JSON marshaling for Objective-C, with Ruby-like string inflections as a bonus.

Installation

  1. Install CocoaPods.

  2. Add the Podfile to your project root:

pod 'JSONObject'
  1. In your project root, install the pod by entering:
pod install
  1. Open the .xcworkspace file in your project directory. From now on, use this workspace instead of the .xcodeproj file.

  2. Add JSONObject to your model object's class header:

#import <JSONObject/NSObject+JSONObject.h>

Usage

  • To convert the model object to JSON wrapped in the key name "object":

    NSData *json = [myObject toJSON:@"object"];

    This JSON data stream is suitable for use in a JSON request.