-
Notifications
You must be signed in to change notification settings - Fork 3
/
NSJSONSerialization+Comments.h
37 lines (27 loc) · 1.37 KB
/
NSJSONSerialization+Comments.h
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
35
36
37
//
// NSJSONSerialization+Comments.h
// ABCodeEditor
//
// Created by Alexander Blach on 22.07.14.
// Copyright (c) 2014 Alexander Blach. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSJSONSerialization (Comments)
+ (NSData *)dataByStrippingJSONCommentsAndWhiteSpaceOfUTF8Data:(NSData *)data
skipBytes:(NSUInteger)bytesToSkip;
// preferred method, since it doesn't need to convert an NSString if the data is encoded with UTF-8
+ (id)JSONObjectWithCommentedData:(NSData *)data
options:(NSJSONReadingOptions)opt
error:(NSError **)error;
+ (id)JSONObjectWithCommentedContentsOfURL:(NSURL *)url
options:(NSJSONReadingOptions)opt
error:(NSError **)error;
+ (id)JSONObjectWithCommentedContentsOfFile:(NSString *)path
options:(NSJSONReadingOptions)opt
error:(NSError **)error;
+ (id)JSONObjectWithCommentedString:(NSString *)string
options:(NSJSONReadingOptions)opt
error:(NSError **)error;
// convenience method if you need an NSString instead of NSData
+ (NSString *)stringWithJSONObject:(id)obj options:(NSJSONWritingOptions)opt error:(NSError **)error;
@end