An Objective-C wrapper for jqlib, the C library behind jq (a lightweight and flexible JSON processor).
Via Cocoapods:
pod 'macOSjqKit'
NSString* program = @"."; // the jq filter
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:@{@"foo":@0, @"bar":@42} options:kNilOptions error:NULL];
// filter
NSArray<NSData*>* results = [LMJqFilter filterWithProgram:program data:jsonData error:NULL];
// enumerate the results
[results enumerateObjectsUsingBlock:^(NSData * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
NSLog(@"result = %@", [[NSString alloc] initWithData:obj encoding:NSUTF8StringEncoding]);
}];
make
Copyright 2019 Paw. MIT License.