HUBJSONPath

@protocol HUBJSONPath <NSObject>

Protocol defining the basic API of an object describing a path to a piece of data within a JSON structure

The Hub Framework uses a path-based approach to JSON parsing, that enables the API user to describe how to retrieve data from a JSON structure using paths - sequences of operations that each perform a JSON parsing task, such as going to a key in a dictionary, or iterating over an array.

You normally don’t have to interact with the APIs defined in this file yourself. Instead, the Hub Framework uses them to retrieve data internally. You might want to construct paths yourself, though, and for that you use the mutable version of this API; HUBMutableJSONPath.

  • Return an array of values by following this path in a JSON dictionary

    Declaration

    Objective-C

    - (nonnull NSArray<id> *)valuesFromJSONDictionary:
        (nonnull NSDictionary<NSString *, NSObject *> *)dictionary;

    Parameters

    dictionary

    The JSON dictionary to apply the path on

    Return Value

    An array of type-checked values, depending on what type that the path is associated with

  • Return a mutable copy of this path, that can be used to extend it with additional operations

    Declaration

    Objective-C

    - (nonnull id<HUBMutableJSONPath>)mutableCopy;