Skip to main content

JSON responses

DrevOps\BehatSteps\Steps\Web\JsonTrait - Source, Steps

Assert JSON responses with path and schema checks.

public function jsonAssertResponseMatchesSchema(string $schema_json): void

Assert that the response validates against a JSON schema

public function jsonDecode(string $content): array

Decode a JSON string into an array

public function jsonDecodeLoose(string $content): mixed

Decode JSON content as loosely-typed data

public function jsonGetContent(): string

Get the response content, or the content a fixture step set in its place

public function jsonGetScalar(string $path): mixed

Get the scalar value a JSONPath expression matches

public function jsonGetValue(string $path): mixed

Get the value a JSONPath expression matches

public function jsonQuery(string $path): array

Run a JSONPath expression against the decoded response