JsonCompareDiff 1.0.4

dotnet add package JsonCompareDiff --version 1.0.4
                    
NuGet\Install-Package JsonCompareDiff -Version 1.0.4
                    
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="JsonCompareDiff" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JsonCompareDiff" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="JsonCompareDiff" />
                    
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 JsonCompareDiff --version 1.0.4
                    
#r "nuget: JsonCompareDiff, 1.0.4"
                    
#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 JsonCompareDiff@1.0.4
                    
#: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=JsonCompareDiff&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=JsonCompareDiff&version=1.0.4
                    
Install as a Cake Tool

📝 JSON Compare Utility

Welcome to the JSON Compare Utility repository! 🚀

This project offers a tool to compare two JSON strings and identify the differences between them. It is ideal for tracking changes in structured data, such as logs or configurations, in a clear and organized manner.

🌟 Features

JSON Comparison: Compare two JSON strings and get all the differences. Ignore Keys: Specify keys that should be ignored during the comparison. Difference Details: Identify insertions, updates, and deletions of values.

📚 Documentation

CompareJson: Compares two JSON strings and returns the differences. HasDifference: Checks if there are differences between two simple JSON strings. DifferenceDetails: Details the differences found, categorizing them into insertions, updates, and deletions.

🔧Requirements

Newtonsoft.Json: Ensure you have the Newtonsoft.Json package installed to use the tool.

🛠️ Usage Example

Imagine you are developing a user profile monitoring system and need to check for changes in profile data after updates.

Run the TestRun project and understand its functionality.

Before: ⬅️

{
    "Name": "John Doe",
    "Age": 30,
    "Address": {
        "Street": "123 Main St",
        "City": "Anytown",
        "State": "CA"
    },
    "Skills": ["C#", "SQL", "JavaScript"]
}

After: ➡️

{
    "Name": "John Doe",
    "Age": 31,
    "Address": {
        "Street": "123 Main St",
        "City": "New Haven",
        "State": "NY"
    },
    "Skills": ["C#", "SQL", "Python"]
}

Expected Response: 🥳

{
    "Age": {
        "updated": [31]
    },
    "Address": {
        "City": {
            "updated": ["New Haven"]
        }
    },
    "Skills": {
        "removed": ["JavaScript"],
        "added": ["Python"]
    }
}

The compared values can also come from a database, using the more traditional JSON style with \ delimiting the JSON and not just dictionaries.

Benefits:

Traceability: Quickly identify changes in user profile data. Efficiency: Reduce time spent analyzing large amounts of JSON data. Flexibility: Ignore specific keys that are not relevant for the comparison.

🚀 Getting Started

Clone the repository: git clone https://github.com/robsongjunior/JsonCompare Open the project in your preferred IDE. Install the necessary dependencies. Use the Compare class to compare your JSONs!

⚠️ I am providing this code as fully open, free, and without any liabilities for its use. The primary goal is to strengthen the open-source community and promote learning. This code is not intended for commercial purposes and should not be used as such. Feel free to study, modify, and distribute the code as you wish, always respecting the principles of the open-source community. The repository is open for contributions, and everyone is welcome to collaborate to further improve this project.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.4 168 6/7/2024