Latest 1.2.1
Homepage https://github.com/amamchur/jsonlite
License Apache License, Version 2.0
Authors

Introduction to jsonlite

What is jsonlite and JsonLite ObjC

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

Design Principles

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
  • No malloc required
  • Good testability
Lightweight

jsonlite is super lite parser. It’s perfect works on microcontrollers with 2k RAM.

Memory usage for parsing depth 32:

  • 64-bit platform200 bytes
  • 32-bit platform116 bytes
Divide and Rule (divide et impera)

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":"Someu0020string"
}

In this case we have string with escaped UNICODE character and jsonlite will provide all information about this token.

token.start == 12; // Start of "Someu0020string"
token.end == 28; // End of "Someu0020string"
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.

Code Coverage

  • 100% Function coverage
  • 100% Statement coverage
  • 100% Branch coverage.

See Code coverage configuration

Image

License

jsonlite and JsonLite ObjC are licensed under the Apache License, Version 2.0

Copyright 2012-2013, Andrii Mamchur

Latest podspec

{
    "name": "JsonLite",
    "version": "1.2.1",
    "summary": "High performance and low memory footprint JSON parser for mobile/embedded systems.",
    "homepage": "https://github.com/amamchur/jsonlite",
    "license": "Apache License, Version 2.0",
    "authors": {
        "Andrii Mamchur": "[email protected]"
    },
    "source": {
        "git": "https://github.com/amamchur/jsonlite.git",
        "tag": "v1.2.1"
    },
    "source_files": [
        "amalgamated/jsonlite/*.{h,c}",
        "objc/*.{h,m}"
    ],
    "public_header_files": [
        "amalgamated/jsonlite/*.h",
        "objc/*.h"
    ],
    "requires_arc": false
}

Pin It on Pinterest

Share This