JSONMatcher

public final class JSONMatcher : NSObject, Sendable

Matcher for a JSON payload.

  • Factory method to create a JSON matcher.

    Declaration

    Swift

    public convenience init(valueMatcher: JSONValueMatcher)

    Return Value

    A JSONMatcher instance.

  • Factory method to create a JSON matcher.

    Declaration

    Swift

    public convenience init(valueMatcher: JSONValueMatcher, scope: [String])

    Return Value

    A JSONMatcher instance.

  • Factory method to create a matcher from a JSON payload.

    Declaration

    Swift

    public convenience init(json: Any?) throws

    Return Value

    A JSONMatcher instance or nil if the JSON is invalid.

  • The matcher’s JSON payload.

    Declaration

    Swift

    public func payload() -> [String : Any]
  • Evaluates the object with the matcher.

    Declaration

    Swift

    public func evaluate(_ value: Any?) -> Bool

    Parameters

    value

    The object to evaluate.

    Return Value

    true if the matcher matches the object, otherwise false.