Skip to content
Aghogho Bernard edited this page May 12, 2026 · 3 revisions

CustomAutoAdapterMapper

CustomAutoAdapterMapper Wiki

A lightweight, flexible JSON-to-object mapper for C# that handles third-party API responses with mismatched property names and nested structures — without requiring per-API contract definitions.

Table of Contents

What it solves

In organizations that integrate with multiple external APIs, you frequently hit:

  • Property mismatches: their workEmail vs your WorkEmail, their desc vs your Description
  • Nested structures: data buried under data.products[] or work.reportsTo.email
  • Per-integration boilerplate: every new API requires its own contract / DTO / wire types

CustomAutoAdapterMapper lets you keep one strongly-typed model and supply per-integration mapping configuration at the call site:

var apiResponse = await httpClient.GetStringAsync("https://api.example.com/employees");
var employees = new List<Employee>();

apiResponse.MapCollection(employees, options =>
{
    options.RootKey = "employees";
    options.ItemKey = "Email";
    options.Mappings = new Dictionary<string, string>
    {
        { "Email", "workEmail" },         // their JSON key → your C# property
        { "FirstName", "firstName" },
        { "ManagerEmail", "supervisorEmail" }
    };
});

The library leaves direct property-name matches alone and only consults the Mappings dictionary for properties whose JSON name differs.

Project links

Target framework

.NET Standard 2.0 — works with .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5+.

Versioning

The library follows semantic versioning. See the Changelog for release notes.

Clone this wiki locally