Files
RestKit/Code/Support/Parsers/JSON/RKJSONParserSBJSON.m
Blake Watters f3c0995d5e Implementation of Object Mapping 2.0 design:
* Removed RestKit from inheritance hierarchy
  * Mappings are implemented as concrete classes
  * Mapper is much more flexible & powerful
  * Much more robust error handling
  * Serialization is reimplemented as an object mapping operation
  * Added ability to serialize to JSON natively
  * Reworked Core Data integration
  * Simplified the codebase substantially
2011-06-11 19:26:56 -04:00

37 lines
861 B
Objective-C

//
// RKJSONParserSBJSON.m
// RestKit
//
// Created by Blake Watters on 3/4/10.
// Copyright 2010 Two Toasters. All rights reserved.
//
#import "RKJSONParserSBJSON.h"
#import "SBJsonParser.h"
#import "SBJsonWriter.h"
@implementation RKJSONParserSBJSON
- (NSDictionary*)objectFromString:(NSString*)string error:(NSError **)error {
SBJsonParser* parser = [[SBJsonParser alloc] init];
id result = [parser objectWithString:string];
if (nil == result) {
*error = [[parser errorTrace] lastObject];
}
[parser release];
return result;
}
- (NSString*)stringFromObject:(id)object error:(NSError **)error {
SBJsonWriter *jsonWriter = [SBJsonWriter new];
NSString *json = [jsonWriter stringWithObject:self];
if (!json) {
*error = [[jsonWriter errorTrace] lastObject];
}
[jsonWriter release];
return json;
}
@end