Kind: Service
Source: Pams/API/Pams.API/Pams.API.csproj (line 1)
Part of: Pams
NuGet package dependency
Newtonsoft.Json is a NuGet package dependency in the Pams API project that serializes .NET objects to JSON and deserializes JSON request data into .NET objects. It supports JSON handling for API responses, request processing, and legacy JSON formatting requirements.
Diagram
mermaidsequenceDiagram participant Client participant API as Pams API participant Json as Newtonsoft.Json Client->>API: Send JSON request API->>Json: Deserialize request body Json-->>API: Return .NET object API->>Json: Serialize response object Json-->>API: Return JSON payload API-->>Client: Send JSON response
Usage
tstype PamsRecord = {
id: string;
status: string;
};
async function getRecord(id: string): Promise<PamsRecord> {
const response = await fetch(`/api/records/${id}`, {
headers: {
Accept: "application/json",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
return response.json();
}
AI Coding Instructions
- Keep JSON property names aligned with the API models and configured Newtonsoft.Json serialization settings.
- Check existing serializer settings before adding converters, naming policies, or date formatting behavior.
- Preserve legacy JSON formats when changing request or response models.
- Add Newtonsoft.Json package references through the Pams API project file when code depends on its types or converters.
Was this page helpful?