# Newtonsoft.Json

**Kind:** Service

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

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

NuGet package dependency

Newtonsoft.Json is a NuGet package dependency in `Pams.Business` for serializing .NET objects to JSON and deserializing JSON into .NET types. It supports JSON handling at business-layer boundaries, including legacy JSON formats and integrations.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Business as Pams.Business
    participant Json as Newtonsoft.Json

    Client->>Business: Send JSON request payload
    Business->>Json: DeserializeObject<T>(payload)
    Json-->>Business: .NET model
    Business->>Json: SerializeObject(response)
    Json-->>Business: JSON response payload
    Business-->>Client: Return JSON response
```

## Usage

```typescript
type PamsRequest = {
  accountId: string;
  status: string;
};

async function submitRequest(request: PamsRequest) {
  const response = await fetch("/api/pams/requests", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify(request),
  });

  return response.json();
}
```

## AI Coding Instructions

- Keep Newtonsoft.Json serialization and deserialization at API, persistence, or integration boundaries.
- Match JSON property names and null-handling behavior expected by legacy consumers.
- Prefer typed .NET models when calling `DeserializeObject<T>()`.
- Check existing serializer settings before adding converters or changing date, enum, or reference-loop handling.
