carhartl/jquery-cookie — pull request #283 by dhoulb (2014-04-10 15:57:28+00:00)
Title: Allow Objects and Arrays to be stored as JSON

Only works on actual {} Objects (and [] Arrays), not typeof "object". Tested with v.constructor === Object || v.constructor === Array

Detects JSON stored in cookies by looking for '[' or '{', using the same RegEx as jQuery's data() function.

If the JSON can't be parsed it returns a string, to allow strings that have brackets like JSON but aren't, e.g. "[hello, this isn't JSON]"

Doesn't interfere with existing config.json, which can still be used to force JSON parsing.

Added 6x tests for reading, saving, and raw URL encoded JSON.

Passes all existing tests, plus 6x new ones.