# HdKey.fromJson

Creates a HD Key from a JSON object containing an extended private key (`xpriv`).

## Imports

:::code-group
```ts [Named]
import { HdKey } from 'ox'
```

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

## Examples

```ts twoslash
import { HdKey } from 'ox'

const hdKey = HdKey.fromJson({ xpriv: '...' })

console.log(hdKey.privateKey)
// @log: '0x...'
```

## Definition

```ts
function fromJson(
  json: {
    xpriv: string;
},
): HdKey
```

**Source:** [src/core/HdKey.ts](https://github.com/wevm/ox/blob/main/src/core/HdKey.ts#L165)

## Parameters

### json

* **Type:** `{
    xpriv: string;
  }`

The JSON object containing an extended private key (`xpriv`).

## Return Type

The HD Key.

`HdKey.HdKey`
