> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# serialization

## EventSerializer

Custom JSON encoder to assist in the serialization of a wide range of objects.

### is\_js\_safe\_integer

```python theme={null}
def is_js_safe_integer(value: int) -> bool
```

Ensure the value is within JavaScript's safe range for integers.

Python's 64-bit integers can exceed this range, necessitating this check.
[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Number/MAX\_SAFE\_INTEGER](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)

## convert\_time\_delta\_to\_ns

```python theme={null}
def convert_time_delta_to_ns(time_delta: dt.timedelta) -> int
```

Convert a timedelta object to nanoseconds.

## convert\_to\_string\_dict

```python theme={null}
def convert_to_string_dict(input_: dict) -> dict[str, str]
```

Convert a dict with arbitrary values to a dict\[str, str] by converting

all values to their string representations.

## serialize\_datetime

```python theme={null}
def serialize_datetime(v: dt.datetime) -> str
```

Serialize a datetime including timezone info.

Uses the timezone info provided if present, otherwise uses the current runtime's timezone info.

UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00.

## serialize\_to\_str

```python theme={null}
def serialize_to_str(input_data: Any) -> str
```

Safely serialize data to a JSON string.
