<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@contract-case/case-definition-dsl](./case-definition-dsl.md) &gt; [matchers](./case-definition-dsl.matchers.md) &gt; [base](./case-definition-dsl.matchers.base.md) &gt; [AnyMatcher](./case-definition-dsl.matchers.base.anymatcher.md) &gt; [toJSON](./case-definition-dsl.matchers.base.anymatcher.tojson.md)

## matchers.base.AnyMatcher.toJSON() method

Only override this method if you are writing a matcher in a language other than TypeScript.

It exists because the ContractCase matcher format is not legal in all languages that ContractCase supports.

WARNING: Do not return a string from this method. You must instead return an object that can be serialised to JSON following the matcher format described in [Extending ContractCase](https://case.contract-testing.io/docs/reference/plugin-framework)<!-- -->.

**Signature:**

```typescript
toJSON(): unknown;
```

**Returns:**

unknown

An object in the matcher format described [in the Extending ContractCase documentation](https://case.contract-testing.io/docs/reference/plugin-framework)
