AI agents: use the documentation index at llms.txt to locate machine-readable pages. This section is indexed by https://docs.particular.net/samples/llms.txt. The markdown version of this page is served as plain text. An MCP server at /mcp serves the same content via the search_docs and read_doc tools; it is read-only and needs no credentials. Markdown versions of documentation pages are available by appending .md to the page URL. Directory URLs use index.md. They are served as text/plain because some retrieval backends reject text/markdown.

System.Text.Json Serializer sample

NuGet Package:
NServiceBus 10.x

This sample uses the System.Text.Json serializer built in to NServiceBus to serialize message payloads.

Configuring to use NServiceBus.Newtonsoft.Json

endpointConfiguration.UseSerialization<SystemJsonSerializer>();

Sending the message

var message = new CreateOrder
{
    OrderId = 9,
    Date = DateTime.Now,
    CustomerId = 12,
    OrderItems =
    [
        new OrderItem()
        {
            ItemId = 6,
            Quantity = 2
        },

        new OrderItem()
        {
            ItemId = 5,
            Quantity = 4
        }

    ]
};
await messageSession.SendLocal(message);

Output

{
  "OrderId": 9,
  "Date": "2015-09-15T10:23:44.9367871+10:00",
  "CustomerId": 12,
  "OrderItems": [
    {
      "ItemId": 6,
      "Quantity": 2
    },
    {
      "ItemId": 5,
      "Quantity": 4
    }
  ]
}

Related Articles

  • Serialization
    .NET messaging systems require serialization and deserialization of objects sent/received over transports. NServiceBus achieves this using serializers.
  • System.Text.Json serializer
    A json serializer using System.Text.Json.