-
Notifications
You must be signed in to change notification settings - Fork 0
/
JSONHelpers.h
44 lines (33 loc) · 1.18 KB
/
JSONHelpers.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
38
39
40
41
42
43
44
//
// JSONHelpers.h
// PenguinSample
//
// Created on 11/5/14.
// Copyright (c) 2014 AT&T. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JSONHelpers : NSObject
// these methods extract the content element from the json response. If content element is the expected type it is returned, otherwise nil is returned
/**
* Extracts the "content" portion of a raw JSON response from an api call
*
* @param jsonData NSData object typically received from api call
*
* @return content section if it exists, otherwise nil
*/
+ (id)contentFromJsonResponse:(NSData *)jsonData;
/**
* Extracts the "content" portion of a raw JSON response as an NSArray
*
* @param jsonData NSData object typically received from api call
* @return content section if it exists and is an NSArray, otherwise nil
*/
+ (NSArray *)contentArrayFromJsonResponse:(NSData *)jsonData;
/**
* Extracts the "content" portion of a raw JSON response as an NSDictionary
*
* @param jsonData NSData object typically received from api call
* @return content section if it exists and is an NSDictionary, otherwise nil
*/
+ (NSDictionary *)contentDictionaryFromJsonResponse:(NSData *)jsonData;
@end