forked from pkyeck/socket.IO-objc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSocketIOJSONSerialization.m
More file actions
34 lines (29 loc) · 929 Bytes
/
SocketIOJSONSerialization.m
File metadata and controls
34 lines (29 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// SocketIOJSONSerialization.m
// v0.5.1
//
// based on
// socketio-cocoa https://github.com/fpotter/socketio-cocoa
// by Fred Potter <fpotter@pieceable.com>
//
// using
// https://github.com/square/SocketRocket
//
// reusing some parts of
// /socket.io/socket.io.js
//
// Created by Philipp Kyeck http://beta-interactive.de
//
// With help from
// https://github.com/pkyeck/socket.IO-objc/blob/master/CONTRIBUTORS.md
//
#import "SocketIOJSONSerialization.h"
@implementation SocketIOJSONSerialization
+ (id) objectFromJSONData:(NSData *)data error:(NSError **)error {
return [NSJSONSerialization JSONObjectWithData:data options:0 error:error];
}
+ (NSString *) JSONStringFromObject:(id)object error:(NSError **)error {
NSData *data = [NSJSONSerialization dataWithJSONObject:object options:0 error:error];
return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
}
@end