-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added option to output JSON, Updated PCI IDs, bump to version 1.6
- Loading branch information
1 parent
571d9ec
commit 1c5e975
Showing
7 changed files
with
123 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// JSON.h | ||
// DPCIManager | ||
// | ||
// Created by Muntashir Al-Islam on 8/18/18. | ||
// See: https://stackoverflow.com/a/20262259/4147849 | ||
// | ||
|
||
#ifndef JSON_h | ||
#define JSON_h | ||
|
||
@interface NSDictionary (BVJSONString) | ||
-(NSString*) bv_jsonStringWithPrettyPrint:(BOOL) prettyPrint; | ||
@end | ||
|
||
@interface NSArray (BVJSONString) | ||
- (NSString *)bv_jsonStringWithPrettyPrint:(BOOL)prettyPrint; | ||
@end | ||
|
||
#endif /* JSON_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// JSON.m | ||
// DPCIManager | ||
// | ||
// Created by Muntashir Al-Islam on 8/18/18. | ||
// See: https://stackoverflow.com/a/20262259/4147849 | ||
// | ||
|
||
#import "JSON.h" | ||
|
||
@implementation NSDictionary (BVJSONString) | ||
-(NSString*) bv_jsonStringWithPrettyPrint:(BOOL) prettyPrint { | ||
NSError *error; | ||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self | ||
options:(NSJSONWritingOptions) (prettyPrint ? NSJSONWritingPrettyPrinted : 0) | ||
error:&error]; | ||
|
||
if (! jsonData) { | ||
NSLog(@"%s: error: %@", __func__, error.localizedDescription); | ||
return @"{}"; | ||
} else { | ||
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; | ||
} | ||
} | ||
@end | ||
|
||
@implementation NSArray (BVJSONString) | ||
-(NSString*) bv_jsonStringWithPrettyPrint:(BOOL) prettyPrint { | ||
NSError *error; | ||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self | ||
options:(NSJSONWritingOptions) (prettyPrint ? NSJSONWritingPrettyPrinted : 0) | ||
error:&error]; | ||
|
||
if (! jsonData) { | ||
NSLog(@"%s: error: %@", __func__, error.localizedDescription); | ||
return @"[]"; | ||
} else { | ||
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; | ||
} | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters