NdjsonDelta 1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package NdjsonDelta --version 1.0.0
NuGet\Install-Package NdjsonDelta -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="NdjsonDelta" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NdjsonDelta" Version="1.0.0" />
<PackageReference Include="NdjsonDelta" />
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 NdjsonDelta --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NdjsonDelta, 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 NdjsonDelta@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=NdjsonDelta&version=1.0.0
#tool nuget:?package=NdjsonDelta&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NdjsonDelta
A .NET library to compute the delta (added, removed, changed objects) between two NDJSON (Newline Delimited JSON) files or strings. Designed for easy integration and NuGet distribution.
Features
- Compare two NDJSON sources and get added, removed, and changed objects
- Simple API for file or string input
- Well-documented public methods
Usage
- Add the NuGet package to your project (instructions will be provided after publishing).
- Use the
NdjsonDeltaCalculator
class to compute deltas between NDJSON sources.
Sample Program
Suppose you have two NDJSON files:
file1.ndjson
{"id": 1, "name": "A"}
{"id": 2, "name": "B"}
{"id": 3, "name": "C"}
file2.ndjson
{"id": 1, "name": "A"}
{"id": 2, "name": "B2"}
{"id": 4, "name": "D"}
Sample C# code:
using System;
using System.Text.Json;
using NdjsonDelta;
class Program
{
static void Main()
{
var calculator = new NdjsonDeltaCalculator();
// Use a key selector for the unique key (e.g., "id")
NdjsonDeltaResult result = calculator.ComputeDeltaFromFiles(
"file1.ndjson", "file2.ndjson", obj => obj.GetProperty("id").GetInt32().ToString());
Console.WriteLine("Added:");
foreach (var item in result.Added)
Console.WriteLine(item);
Console.WriteLine("Removed:");
foreach (var item in result.Removed)
Console.WriteLine(item);
Console.WriteLine("Changed:");
foreach (var (oldObj, newObj) in result.Changed)
{
Console.WriteLine($"Old: {oldObj}");
Console.WriteLine($"New: {newObj}");
}
}
}
Expected Output:
Added:
{"id":4,"name":"D"}
Removed:
{"id":3,"name":"C"}
Changed:
Old: {"id":2,"name":"B"}
New: {"id":2,"name":"B2"}
License
Specify your license here (e.g., MIT, Apache 2.0, etc.).
Publishing
See instructions below for publishing to NuGet.org after implementation and packaging.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net8.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.