AnotherJsonLibrary 1.0.127

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

Another Json Library

Overview

Another Json Library is a powerful and comprehensive toolkit for JSON manipulation in C#/.NET applications. It goes beyond basic serialization and deserialization to provide advanced JSON operations like comparison, patching, path querying, and streaming large JSON files efficiently. Designed with performance and developer experience in mind, this library serves as a complete solution for working with JSON data in modern .NET applications.

Documentation

Features

  • Serialization & Deserialization: Efficiently convert C# objects to JSON and back with convenient extension methods and support for complex type hierarchies.
  • Advanced Comparison: Compare JSON documents with fine-grained control over case sensitivity, whitespace handling, and array ordering for precise difference detection.
  • JSON Pointer Support: Navigate and manipulate JSON documents using standardized JSON Pointer syntax (RFC 6901) for targeted operations.
  • JSON Path Querying: Extract specific data from complex JSON documents using powerful JSONPath expressions with support for advanced filtering and projection.
  • Patch Generation & Application: Create and apply JSON patches following RFC 6902 specifications to update documents efficiently with minimal data transfer.
  • Efficient Streaming: Process large JSON files token by token without loading the entire content into memory, ideal for big data scenarios.
  • Document Transformation: Merge, minify, and canonicalize JSON documents with configurable options to maintain semantic equivalence.
  • Difference Analysis: Identify and report detailed differences between JSON structures with customizable output formats.
  • Property Mapping: Transform JSON documents by mapping properties from one structure to another, perfect for data migration and API integration.
  • Schema Validation: Validate JSON documents against JSON Schema definitions to ensure data integrity and structure compliance.
  • Performance Optimization: Designed with high-performance use cases in mind, featuring minimal allocations and efficient algorithms.
  • Canonicalization: Create canonical representations of JSON documents for cryptographic operations and comparison.
  • Security Features: Protect against JSON injection attacks and secure handling of sensitive data.

Usage

ToJson

var simpleObject = new SimpleObject { Id = 1, Name = "John" };
string json = simpleObject.ToJson();
// json now contains '{"Id":1,"Name":"John"}'

FromJson

string json = "{\"Id\":1,\"Name\":\"John\"}";
var simpleObject = json.FromJson<SimpleObject>();
// simpleObject is now an instance of SimpleObject with Id=1 and Name="John"

AreEqual

string json1 = "{\"Id\":1,\"Name\":\"John\"}";
string json2 = "{\"Name\":\"John\",\"Id\":1}";
bool areEqual = json1.AreEqual(json2, ignoreWhitespace: true);
// areEqual is true, ignoring whitespace and field order

StreamJsonFile

string filePath = "app.log";

filePath.StreamJsonFile((tokenType, tokenValue) => {
    // Process each token as it's read from the file
    if (tokenType == JsonTokenType.PropertyName && tokenValue.ToString() == "level" && 
        reader.Read() && reader.GetString() == "INFO") {
        // Process INFO level entries
    }
});

MapProperties

// Original JSON with customer data
string customerJson = @"{
    ""CustomerName"": ""John Smith"",
    ""CustomerID"": 12345,
    ""Address"": {
        ""Street"": ""123 Main St"",
        ""City"": ""Springfield"",
        ""ZIP"": ""12345""
    }
}";

// Define property mapping for API standards
var propertyMapping = new Dictionary<string, string>
{
    {"CustomerName", "name"},
    {"CustomerID", "id"},
    {"Street", "streetAddress"},
    {"ZIP", "postalCode"}
};

// Apply the mapping
string transformedJson = customerJson.MapProperties(propertyMapping);

For detailed usage examples and API documentation, please refer to the documentation links above.

Installation

dotnet add package AnotherJsonLib

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product 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.

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.127 178 4/1/2025
1.0.99 326 10/17/2023