---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [config](../index.md) / loadDwJson

# Function: loadDwJson()

> **loadDwJson**(`options`): `Promise`\<[`LoadDwJsonResult`](../interfaces/LoadDwJsonResult.md) \| `undefined`\>

Defined in: [packages/b2c-tooling-sdk/src/config/dw-json.ts:523](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/config/dw-json.ts#L523)

Loads configuration from a dw.json file.

If an explicit path is provided, uses that file. Otherwise, looks for dw.json
in the projectDirectory (or cwd). Does NOT search parent directories.

Use `findDwJson()` if you need to search upward through parent directories.

## Parameters

### options

[`LoadDwJsonOptions`](../interfaces/LoadDwJsonOptions.md) = `{}`

Loading options

## Returns

`Promise`\<[`LoadDwJsonResult`](../interfaces/LoadDwJsonResult.md) \| `undefined`\>

The parsed config with its path, or undefined if no dw.json found

## Example

```ts
// Load from ./dw.json (current directory)
const result = loadDwJson();
if (result) {
  console.log(`Loaded from ${result.path}`);
  console.log(result.config.hostname);
}

// Load from specific directory
const result = loadDwJson({ projectDirectory: '/path/to/project' });

// Use named instance
const result = loadDwJson({ instance: 'staging' });

// Explicit path
const result = loadDwJson({ path: './config/dw.json' });
```
