All Projects → mirek → CoreJSON

mirek / CoreJSON

Licence: other
Core Foundation, libyajl based JSON support.

Programming Languages

c
50402 projects - #5 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to CoreJSON

node-perj
A fast, flexible JSON logger.
Stars: ✭ 16 (-66.67%)
Mutual labels:  fast
dpar
Neural network transition-based dependency parser (in Rust)
Stars: ✭ 41 (-14.58%)
Mutual labels:  parsing
eec
A fast and lower memory excel write/read tool.一个非POI底层,支持流式处理的高效且超低内存的Excel读写工具
Stars: ✭ 93 (+93.75%)
Mutual labels:  fast
cookie
Landing website + Blog using Jekyll & Tailwind CSS
Stars: ✭ 61 (+27.08%)
Mutual labels:  fast
left-recursion
Quick explanation of eliminating left recursion in Haskell parsers
Stars: ✭ 36 (-25%)
Mutual labels:  parsing
osprey-delight
Osprey Delight is the free-minded artist's choice for a clutter-free and blazingly fast single-page portfolio.
Stars: ✭ 43 (-10.42%)
Mutual labels:  fast
fyodor
Convert your Amazon Kindle highlights and notes into markdown (or any format).
Stars: ✭ 101 (+110.42%)
Mutual labels:  parsing
Mimir
📱 A simple & efficient iOS logging framework for high usage apps
Stars: ✭ 13 (-72.92%)
Mutual labels:  fast
docx2csv
Extracts tables from .docx files and saves them as .csv or .xls files
Stars: ✭ 42 (-12.5%)
Mutual labels:  parsing
markright
A customizable markdown parser in Elixir: pure pattern matching.
Stars: ✭ 14 (-70.83%)
Mutual labels:  parsing
ansicolor
A JavaScript ANSI color/style management. ANSI parsing. ANSI to CSS. Small, clean, no dependencies.
Stars: ✭ 91 (+89.58%)
Mutual labels:  parsing
cortexm-AES
high performance AES implementations optimized for cortex-m microcontrollers
Stars: ✭ 18 (-62.5%)
Mutual labels:  fast
socks-proxy
优雅访问国外技术网站 方便程序员学习 按时收费 不用不花钱
Stars: ✭ 15 (-68.75%)
Mutual labels:  fast
pe
Fastest general-purpose parsing library for Python with a familiar API
Stars: ✭ 21 (-56.25%)
Mutual labels:  parsing
apprankings
App Store Rankings Scraper
Stars: ✭ 37 (-22.92%)
Mutual labels:  appstore
ultra-sort
DSL for SIMD Sorting on AVX2 & AVX512
Stars: ✭ 29 (-39.58%)
Mutual labels:  fast
HArray
Fastest Trie structure (Linux & Windows)
Stars: ✭ 89 (+85.42%)
Mutual labels:  fast
sledgehammer
🔨 📶 WiFi-Jammer/DoS toolset
Stars: ✭ 34 (-29.17%)
Mutual labels:  parsing
comby-rust
Rust refactoring templates for comby, the structural find-and-replace tool.
Stars: ✭ 23 (-52.08%)
Mutual labels:  parsing
lampager-laravel
Rapid pagination for Laravel
Stars: ✭ 71 (+47.92%)
Mutual labels:  fast

CoreJSON Framework

CoreJSON is iOS and OSX Core Foundation based fast parser and generator based on libyajl C library.

Comparison with other JSON frameworks:

Chart

Tests performed with https://github.com/samsoffes/json-benchmarks

Usage

Parsing in Objective-C:

NSError *error = nil;
id object = (id)JSONCreateWithString(NULL, (CFStringRef)@"[foo, bar]", kJSONReadOptionsDefault, (CFErrorRef *)&error);
if (object) {
  // Do something with object (NSArray)
  [object release];
}

Parsing in C:

CFErrorRef error = NULL;
CFTypeRef object = JSONCreateWithString(NULL, CFSTR("[foo, bar]"), kJSONReadOptionsDefault, &error);
if (object) {
  // Do something with object
  CFRelease(object);
}

Generating in Objective-C:

NSArray *array = [NSArray arrayWithObjects: @"foo", @"bar", nil];
NSError *error = nil;
NSString *json = (id)JSONCreateString(NULL, array, kJSONWriteOptionsDefault, (CFErrorRef *)&error);
if (json) {
  // Do something with json string
  [json release];
}
[array release];

Generating in C:

CFTypeRef values[] = { CFSTR("foo"), CFSTR("bar") };
CFArrayRef array = CFArrayCreateMutable(NULL, values, 2, &kCFTypeArrayCallBacks);
CFErrorRef error = NULL;
CFStringRef json = JSONCreateString(NULL, array, kJSONWriteOptionsDefault, &error);
if (json) {
  // Do something with json string
  CFRelease(json);
}
CFRelease(array);

You should also take care of error object

Options

JSONReadOptions:

  • kJSONReadOptionCheckUTF8 = 1 -- Check UTF8 strings
  • kJSONReadOptionAllowComments = 2 -- Allow /* comments */
  • kJSONReadOptionsDefault = 0 -- Default options (don't check UTF8 strings and do not allow comments)
  • kJSONReadOptionsCheckUTF8AndAllowComments = 3 -- Check UTF8 strings and allow comments

JSONWriteOptions:

  • kJSONWriteOptionIndent = 1 -- Indent generated JSON string
  • kJSONWriteOptionsDefault = 0 -- Default options (do not indent JSON string)

Using in your projects

There are just 2 files CoreJSON.h and CoreJSON.c you'll need together with libyajl.

For your own (non Mac AppStore) OSX projects the quick way is to:

  1. brew install yajl
  2. add /usr/local/lib to Library Search Path and /usr/local/include to Header Search Path
  3. Just drop CoreJSON.h and CoreJSON.c to your project and have fun

For OSX and iOS (Mac AppStore/AppStore) projects you need to include libyajl and drop CoreJSON.h and CoreJSON.c files to your project. One way to do it:

  1. Go to your project's directory (for which you're using git, right? ;) and git submodule add git://github.com/mirek/CoreJSON.git CoreJSON
  2. From Xcode add CoreJSON.h and CoreJSON.c files to your project
  3. If you're already using libyajl in your project, you are good to go. If not, add libyajl files

License

The MIT License

Copyright 2011 Mirek Rusin <mirek [at] me [dot] com>
               http://github.com/mirek/CoreJSON

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].