Apiconvert.Core 1.0.0

dotnet add package Apiconvert.Core --version 1.0.0
                    
NuGet\Install-Package Apiconvert.Core -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Apiconvert.Core" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Apiconvert.Core" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Apiconvert.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Apiconvert.Core --version 1.0.0
                    
#r "nuget: Apiconvert.Core, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Apiconvert.Core@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Apiconvert.Core&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Apiconvert.Core&version=1.0.0
                    
Install as a Cake Tool

Apiconvert.Core

Apiconvert.Core is the .NET conversion engine for JSON, XML, and query payloads.

Rules Model

Rules use a single ordered rules array with recursive nodes:

  • kind: "field" maps one source into one or more outputPaths
  • kind: "array" maps array items using recursive itemRules
  • kind: "branch" evaluates an expression and runs then / elseIf / else

Supported field source types:

  • path
  • constant
  • transform
  • merge
  • condition

Supported transforms:

  • toLowerCase
  • toUpperCase
  • number
  • boolean
  • concat
  • split

Supported merge modes:

  • concat
  • firstNonEmpty
  • array

Additional rule/source options:

  • field: optional defaultValue
  • array: optional coerceSingle
  • condition source: optional trueSource / falseSource, trueValue / falseValue, elseIf, and conditionOutput (branch or match)

Example

using Apiconvert.Core.Converters;
using Apiconvert.Core.Rules;

var rules = new ConversionRules
{
    InputFormat = DataFormat.Json,
    OutputFormat = DataFormat.Json,
    Rules =
    [
        new RuleNode
        {
            Kind = "branch",
            Expression = "path(status) == 'active'",
            Then =
            [
                new RuleNode
                {
                    Kind = "field",
                    OutputPaths = ["meta.enabled"],
                    Source = new ValueSource { Type = "constant", Value = "true" }
                }
            ],
            Else =
            [
                new RuleNode
                {
                    Kind = "field",
                    OutputPaths = ["meta.enabled"],
                    Source = new ValueSource { Type = "constant", Value = "false" }
                }
            ]
        }
    ]
};

var inputJson = """{ "status": "active" }""";
var (input, parseError) = ConversionEngine.ParsePayload(inputJson, rules.InputFormat);
if (parseError is not null) throw new Exception(parseError);

var result = ConversionEngine.ApplyConversion(input, rules);
if (result.Errors.Count > 0) throw new Exception(string.Join("; ", result.Errors));

var outputJson = ConversionEngine.FormatPayload(result.Output, rules.OutputFormat, pretty: true);
Console.WriteLine(outputJson);

Condition Expressions

Condition sources and branch rules use expression syntax with path(...) and exists(...).

Examples:

  • path(score) >= 70
  • path($.meta.source) == 'api' && exists(path(value))

Parse and Format Helpers

ConversionEngine also exposes payload helpers:

  • ParsePayload(string, DataFormat) and stream/JsonNode overloads
  • FormatPayload(object?, DataFormat, bool) and stream overload
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 123 2/13/2026
0.2.0 112 2/11/2026
0.1.1 107 2/10/2026
0.1.0 108 2/6/2026
0.0.21 112 2/5/2026
0.0.20 107 2/5/2026
0.0.19 109 2/5/2026
0.0.18 107 2/5/2026
0.0.17 107 2/5/2026
0.0.16 117 2/5/2026
0.0.15 111 2/5/2026
0.0.14 105 2/5/2026
0.0.13 107 2/5/2026
0.0.12 105 2/5/2026
0.0.11 104 2/5/2026
0.0.10 113 2/5/2026
0.0.9 108 2/5/2026
0.0.8 106 2/5/2026
0.0.7 115 2/3/2026
0.0.6 114 2/3/2026
Loading failed