jqKit
An Objective-C wrapper for jqlib, the C library behind jq (a lightweight and flexible JSON processor).
Installation
Via Cocoapods:
pod 'macOSjqKit'
Usage
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]);
}];
Development
libjq
and oniguruma
Build make
Influences
License
Copyright 2019 Paw. MIT License.