# Newtonsoft.Json

**Kind:** Service

**Source:** `Pams/API/Pams.API.Core/Pams.API.Core.csproj` (line 1)

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

NuGet package dependency

`Newtonsoft.Json` is a NuGet package dependency declared in `Pams.API.Core.csproj`. It provides JSON serialization and deserialization for API models, request payloads, and persisted data within the Pams API Core project.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant API as Pams API Core
    participant Json as Newtonsoft.Json

    Client->>API: Send JSON request
    API->>Json: Deserialize request payload
    Json-->>API: Return .NET model
    API->>Json: Serialize response model
    Json-->>API: Return JSON response
    API-->>Client: Send JSON response
```

## Usage

```typescript
type PamsRecord = {
  id: string;
  status: string;
};

const response = await fetch("/api/records/record-id");
const record: PamsRecord = await response.json();

console.log(record.status);
```

## AI Coding Instructions

- Keep the `Newtonsoft.Json` package reference in `Pams.API.Core.csproj` aligned with project dependency conventions.
- Use Newtonsoft.Json attributes when API JSON field names differ from .NET property names.
- Configure serialization settings consistently at the API boundary to avoid differing date, null, or enum formats.
- Avoid mixing Newtonsoft.Json and `System.Text.Json` annotations on the same model unless the serializer behavior is explicitly defined.
