# Newtonsoft.Json

**Kind:** Service

**Source:** `Pams/Logic/Pams.Storage/Pams.Storage.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`Newtonsoft.Json` is a NuGet package dependency referenced by `Pams.Storage`. It provides JSON serialization and deserialization for storage-layer data models, including support for legacy JSON formats.

## Diagram

```mermaid
sequenceDiagram
    participant Storage as Pams.Storage
    participant Json as Newtonsoft.Json
    participant Data as Stored JSON

    Storage->>Json: Deserialize stored content
    Json->>Data: Read JSON fields
    Data-->>Json: Return JSON data
    Json-->>Storage: Return storage model
```

## Usage

```ts
type StorageRecord = {
  id: string;
  metadata: Record<string, unknown>;
};

const payload = '{"id":"record-a","metadata":{"source":"legacy"}}';

const record: StorageRecord = JSON.parse(payload);

console.log(record.metadata.source);
```

## AI Coding Instructions

- Keep `Newtonsoft.Json` usage within `Pams.Storage` serialization and deserialization boundaries.
- Preserve JSON property names expected by existing stored data and legacy formats.
- Handle missing, null, or malformed JSON values before mapping them to storage models.
- Avoid changing serializer settings without checking compatibility with existing persisted records.

## Used by

9 references from 9 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (9)

- `Pams.API` — `Pams/API/Pams.API/Pams.API.csproj`:1
- `Pams.API.Core` — `Pams/API/Pams.API.Core/Pams.API.Core.csproj`:1
- `Pams.Core` — `Pams/Core/Pams.Core/Pams.Core.csproj`:1
- `Pams.Security` — `Pams/Core/Pams.Security/Pams.Security.csproj`:1
- `HelperTool` — `Pams/HelperTool/HelperTool.csproj`:1
- `Pams.Business` — `Pams/Logic/Pams.Business/Pams.Business.csproj`:1
- `Pams.CurrencyConverter` — `Pams/Logic/Pams.CurrencyConverter/Pams.CurrencyConverter.csproj`:1
- `Pams.Email` — `Pams/Logic/Pams.Email/Pams.Email.csproj`:1

…and 1 more.
