# API Reference

This section provides detailed information about the API functions provided by JSDC Loader. The library is intentionally kept simple, focusing on two core functions that handle all the necessary operations.

## Core Functions

* [**jsdc\_load**](/jsdc_loader/api-reference/jsdc_load.md): Load JSON configuration files into strongly-typed dataclass objects
* [**jsdc\_dump**](/jsdc_loader/api-reference/jsdc_dump.md): Serialize dataclass objects back to JSON configuration files

## Function Overview

### `jsdc_load(file_path, data_class, encoding='utf-8')`

The `jsdc_load` function reads a JSON file and converts it to a dataclass instance, handling nested structures, enums, and type conversion. [Read more](/jsdc_loader/api-reference/jsdc_load.md)

```python
from jsdc_loader import jsdc_load
from myapp.config import AppConfig

# Load configuration from file
config = jsdc_load('config.json', AppConfig)
```

### `jsdc_dump(obj, output_path, encoding='utf-8', indent=4)`

The `jsdc_dump` function serializes a dataclass object to a JSON file, properly handling nested dataclasses, enum types, and complex structures. [Read more](/jsdc_loader/api-reference/jsdc_dump.md)

```python
from jsdc_loader import jsdc_dump
from myapp.config import AppConfig

# Update and save configuration
config = AppConfig()
config.debug = True
jsdc_dump(config, 'config.json')
```

## Type Support

JSDC Loader supports the following types:

* **Simple types**: `str`, `int`, `float`, `bool`
* **Collection types**: `list`, `dict` (with proper type annotations)
* **Complex types**: `Enum`, nested dataclasses
* **Optional types**: `Optional[T]` or `Union[T, None]`

For all complex and collection types, remember to use `field(default_factory=lambda: ...)`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://personal-151.gitbook.io/jsdc_loader/api-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
