Yini
1.0
|
The JSON writer class. More...
#import <DBJsonWriter.h>
Public Member Functions | |
(NSString *) | - stringWithFragment: |
![]() | |
(void) | - addErrorWithCode:description: |
(void) | - clearErrorTrace |
![]() | |
(NSString *) | - stringWithObject: |
Return JSON representation (or fragment) for the given object. |
Additional Inherited Members | |
![]() | |
NSMutableArray * | errorTrace |
NSUInteger | depth |
![]() | |
NSUInteger | maxDepth |
The maximum recursing depth. | |
NSArray * | errorTrace |
Return an error trace, or nil if there was no errors. | |
![]() | |
BOOL | humanReadable |
Whether we are generating human-readable (multiline) JSON. | |
BOOL | sortKeys |
Whether or not to sort the dictionary keys in the output. |
The JSON writer class.
Objective-C types are mapped to JSON types in the following way:
In JSON the keys of an object must be strings. NSDictionary keys need not be, but attempting to convert an NSDictionary with non-string keys into JSON will throw an exception.
NSNumber instances created with the +initWithBool: method are converted into the JSON boolean "true" and "false" values, and vice versa. Any other NSNumber instances are converted to a JSON number the way you would expect.
- (NSString*) stringWithFragment: | (id) | value |