Skip to content
Commits on Mar 31, 2011
  1. Fix a bug when serializing numbers. Somehow the % got dropped from th…

    committed
    …e .17g floating point format specifier.
  2. Merge branch 'master' into experimental

    committed
    Conflicts:
    	JSONKit.m
Commits on Mar 28, 2011
  1. Fixes a bug when trying to retrieve a key from a dictionary that cont…

    committed
    …ains no items (div by zero: (keyHash % dictionary->capacity))
  2. Modified the JSONKit so that it is dual licensed under either the BSD…

    committed
    … or Apache v2.0 license. This was motivated by the discussion at facebookarchive/three20#465
Commits on Mar 25, 2011
  1. Try to clean up githubs markdown parsing of *s in <pre> blocks... mis…

    committed
    …sed a few from the last round
  2. Two major changes and one minor change in this commit.

    committed
    Minor change: When JKSerializeOptionPretty is enabled, JSONKit now sorts the keys.
    
    Major changes:
    
    The way that JSONKit implements the collection classes was modified.  Specifically, JSONKit now follows the same strategy that the Cocoa collection classes use, which is to have a single subclass of the mutable collection class.  This concrete subclass has an ivar bit that determines whether or not that instance is mutable, and when an immutable instance receives a mutating message, it throws an exception.
    
    The second change is a new feature.  Normally, JSONKit can only serialize NSNull, NSNumber, NSString, NSArray, and NSDictioonary like objects.  It is now possible to serialize an object of any class via either a delegate or a ^block.
    
    The delegate or ^block must return an object that can be serialized by JSONKit, however, otherwise JSONKit will fail to serialize the object.  In other words, JSONKit tries to serialize an unsupported class of the object just once, and if the delegate or ^block returns another unsupported class, the second attempt to serialize will fail.  In practice, this is not a problem at all, but it does prevent endless recursive attempts to serialize an unsupported class.
    
    This makes it trivial to serialize objects like NSDate or NSData.  A NSDate object can be formatted using a NSDateFormatter to return a ISO-8601 'YYYY-MM-DDTHH:MM:SS.sssZ' type object, for example.  Or a NSData object could be Base64 encoded.
    
    This greatly simplifies things when you have a complex, nested objects with objects that do not belong to the classes that JSONKit can serialize.
    
    It should be noted that the same caching that JSONKit does for the supported class types also applies to the objects of an unsupported class- if the same object is serialized more than once and the object is still in the serialization cache, JSONKit will copy the previous serialization result instead of invoking the delegate or ^block again.  Therefore, you should not expect or depend on your delegate or block being called each time the same object needs to be serialized AND the delegate or block MUST return a "formatted object" that is STRICTLY invariant (that is to say the same object must always return the exact same formatted output).
Commits on Mar 23, 2011
  1. This commit includes the "Serialize a single NSString" feature/pull r…

    committed
    …equest from issue #4 and issue #11.  Also replaces jk_encode() function with the JKSerializer class.  This is a forward looking change as placing the state in to an autoreleased object that does serializing means that we can always make sure that any resources we might have allocated will get released, no matter what.  This could be a problem, for example, if something throws an exception while we are serializing.
Commits on Mar 22, 2011
  1. Fix a couple of potential memory leaks in extremely unlikely and rare…

    committed
    … circumstances. Modify the primary parsing initial token matcher to use a if/else if/else if structure instead of switch()/case and organize the if statements to occur in the order they are statistically likely to appear in JSON for a performance win. Also make a minor README.md tweak.
  2. Minor tidies.

    committed
  3. Misc documentation updates.

    committed
Commits on Mar 21, 2011
  1. Catch a few additional NSInvalidArgument exception cases that the Cco…

    committed
    …ca collection classes catch.
  2. Minor change to the method swizzling functions. It doesn't make a dif…

    committed
    …ference in the way we use it, but this corrects it so that it is more 'correct'.
  3. Changed the way jk_encode_write1 is handled so that the optimizer is …

    committed
    …able to do a better job. Also modified jk_encode_printf to fix a potential bug wrt/ va_end, and used a va_copy() to make a copy of the varArgs. This is needed if the first vsnprintf overruns the buffer and we need to call it again, the first call may leave the passed varArgs in a state that is unusable by the next call- hence we make a va_copy and use the copy on the second call. Also did some tidies on various jk_encode_write|print functions.
Commits on Mar 17, 2011
  1. Additional assertion checks wrt/ issue #9. Issue #9 looks like it cou…

    committed
    …ld be a stack smash? The assertion checks make sure we're only copying legal values and not writing past a buffer by accident.
Commits on Mar 12, 2011
Commits on Mar 11, 2011
  1. Fixes a bug. See issue #8.

    committed
Commits on Mar 8, 2011
  1. Adds automatic gzip decompression for any JSON that is to be parsed. …

    committed
    …Can gzip the serialized JSON by passing JKSerializeOptionCompress to -JSONDataWithOptions:error:
  2. Fix merge typo.

    committed
Commits on Mar 6, 2011
  1. Significantly improve writing/serializing performance by caching the …

    committed
    …offset in the buffer for the last conversion for an object.
Commits on Mar 4, 2011
Commits on Mar 3, 2011
  1. Some changes to the way cache aging is handled that improves L1 cache…

    committed
    … locality. Changes some of the convience functions so that they leave as little autorelease pending allocations hanging around as possible to minimize our memory footprint.
Something went wrong with that request. Please try again.