# Authenticator.getClientDataJSON

Constructs the Client Data in stringified JSON format which represents client data that was passed to `credentials.get()` or `credentials.create()`.

:::warning
This function is mainly for testing purposes or for manually constructing client data. In most cases you will not need this function. `clientDataJSON` is typically returned as part of the authenticator response.
:::

## Imports

:::code-group
```ts [Named]
import { Authenticator } from 'ox/webauthn'
```

```ts [Entrypoint]
import * as Authenticator from 'ox/webauthn/Authenticator'
```
:::

## Examples

```ts twoslash
import { Authenticator } from 'ox/webauthn'

const clientDataJSON = Authenticator.getClientDataJSON({
  challenge: '0xdeadbeef',
  origin: 'https://example.com'
})
// @log: "{"type":"webauthn.get","challenge":"3q2-7w","origin":"https://example.com","crossOrigin":false}"
```

## Definition

```ts
function getClientDataJSON(
  options: getClientDataJSON.Options,
): string
```

**Source:** [src/webauthn/Authenticator.ts](https://github.com/wevm/ox/blob/main/src/webauthn/Authenticator.ts#L218)

## Parameters

### options

* **Type:** `getClientDataJSON.Options`

Options to construct the client data.

#### options.challenge

* **Type:** `0x${string}`

The challenge to sign.

#### options.crossOrigin

* **Type:** `boolean`
* **Optional**

If set to `true`, it means that the calling context is an `<iframe>` that is not same origin with its ancestor frames.

#### options.extraClientData

* **Type:** `Record`
* **Optional**

Additional client data to include in the client data JSON.

#### options.origin

* **Type:** `string`
* **Optional**

The fully qualified origin of the relying party which has been given by the client/browser to the authenticator.

#### options.type

* **Type:** `"webauthn.create" | "webauthn.get"`
* **Optional**

The WebAuthn ceremony type.

## Return Type

The client data.

`string`
