JSONMatcher

@objc(UAJSONMatcher)
public final class JSONMatcher : NSObject, Sendable

Matcher for a JSON payload.

  • Factory method to create a JSON matcher.

    Declaration

    Swift

    @objc
    public convenience init(valueMatcher: JSONValueMatcher)

    Return Value

    A JSONMatcher instance.

  • Factory method to create a JSON matcher.

    Declaration

    Swift

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

    Return Value

    A JSONMatcher instance.

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

    Declaration

    Swift

    @objc(initWithJSON:error:)
    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

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

    Declaration

    Swift

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

    Parameters

    value

    The object to evaluate.

    Return Value

    true if the matcher matches the object, otherwise false.