Latest 1.0.1
Homepage https://github.com/jrturton/NSJSONSerialization-NSNullRemoval
License MIT
Authors

Build Status

Categories on NSJSONSerialization, NSMutableDictionary and NSMutableArray to recursively remove NSNull objects often returned from JSON web services.

To directly remove from a JSON web response:

stripped = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil removingNulls:YES ignoreArrays:NO];

The ignoreArrays parameter will leave NSNull objects contained directly within arrays in place, for situations when the count of the returned array is important.

NSJSONReadingMutableContainers will be force added to the options if it is not present, since the null removal depends on it.

Methods are also available to recursively remove NSNull objects from dictionaries and arrays, if preferred:

[mutableArray recursivelyRemoveNulls];

or

[mutableArray recursivelyRemoveNullsIgnoringArrays:YES];

Latest podspec

{
    "name": "NSJSONSerialization-NSNullRemoval",
    "version": "1.0.1",
    "license": "MIT",
    "summary": "Categories on NSJSONSerialization, NSMutableDictionary and NSMutableArray to recursively remove NSNull objects returned from JSON services.",
    "homepage": "https://github.com/jrturton/NSJSONSerialization-NSNullRemoval",
    "authors": {
        "Richard Turton": "[email protected]"
    },
    "source": {
        "git": "https://github.com/jrturton/NSJSONSerialization-NSNullRemoval.git",
        "tag": "1.0.1"
    },
    "source_files": "Source/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This