Skip to content

Newtonsoft.Json

reference
1 min readUpdated

Kind: Service

Source: Pams/Core/Pams.Core/Pams.Core.csproj (line 1)

Part of: Pams

NuGet package dependency

Newtonsoft.Json is a NuGet package dependency in Pams.Core for serializing objects to JSON and deserializing JSON into .NET types. It supports JSON handling for legacy-format data exchanged by PAMS Core components.

Diagram

mermaid
sequenceDiagram
    participant Caller
    participant PamsCore as Pams.Core
    participant Json as Newtonsoft.Json

    Caller->>PamsCore: Send JSON payload
    PamsCore->>Json: Deserialize payload
    Json-->>PamsCore: Return .NET object
    PamsCore->>Json: Serialize response object
    Json-->>PamsCore: Return JSON text
    PamsCore-->>Caller: Return JSON response

Usage

ts
type LegacyRecord = {
  reference: string;
  status: string;
};

async function sendLegacyRecord(record: LegacyRecord) {
  const response = await fetch("/pams-core/records", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify(record),
  });

  if (!response.ok) {
    throw new Error("Pams.Core rejected the JSON payload.");
  }

  return response.json();
}

await sendLegacyRecord({
  reference: "PAMS-REQUEST",
  status: "Pending",
});

AI Coding Instructions

  • Keep Newtonsoft.Json references within Pams.Core code that reads or writes JSON payloads.
  • Preserve JSON property names and shapes expected by legacy-format integrations.
  • Check null handling and missing fields when deserializing external JSON.
  • Do not replace Newtonsoft.Json with another serializer without checking legacy JSON behavior and dependent integrations.

Was this page helpful?

Download as PDF