jsonlite is JSON tokenizer. It's lightweight C library that can be used for low-level JSON processing or parser development.
JsonLite for Objective-C is JSON parser base on jsonlite. It's the high performance and flexible JSON parser for Objective-C. You may use JsonLiteObj instead of NSJSONSerialization when your application needs:
- Avoid duplicates of key & value
- Binding/mapping JSON to model
- Serialization model to JSON
- Working with NSURL, NSDate, NSDecimal or base64
- Chunk processing
- Custom converters
jsonlite designed as goto driven finite state machine. This approach provides a lot of benefits such as:
- Very very fast parsing
- Low memory footprint
- Streaming parsing
- Depth checking
- Size of JSON payload doesn't influence memory usage
- Recursion free
- Good testability
jsonlite is super lite parser. It's perfect works on microcontrollers with 2k RAM.
Memory usage for parsing depth 32:
- 64-bit platform - 200 bytes
- 32-bit platform - 116 bytes
It's main principle of jsonlite design. jsonlite doesn't perform any decoding by itself, but provides reach API for token processing instead of that. Let's look at the following example:
{
"string":"Some\u0020string"
}
In this case we have string with escaped UNICODE character and jsonlite will provide all information about this token.
token.start == 12; // Start of "Some\u0020string"
token.end == 28; // End of "Some\u0020string"
token.type.string == jsonlite_string_ascii | jsonlite_string_unicode_escape; // Token attributes
And now is your turn, you may:
- Decode token (jsonlite_token_to_uft8 or jsonlite_token_to_uft16)
- Pass it as raw value to jsonlite_builder (see Beautifier example)
- Terminate parsing using jsonlite_parser_terminate
- Or something else
jsonlite - divides; you - rule.
- 100% Function coverage
- 100% Statement coverage
- 100% Branch coverage.
See Code coverage configuration
jsonlite and JsonLite ObjC are licensed under the Apache License, Version 2.0
Copyright 2012-2013, Andrii Mamchur