Proctorio.JSON 3.1.0

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

Proctorio.JSON

NuGet Build Status Code Coverage License: Apache 2.0 Dependencies

A lightweight, high-performance JSON array encoder/decoder library for .NET. Provides simple, fast JSON array encoding and decoding without complex object mapping.

✨ Features

  • 🚀 Fast & Lightweight - Zero runtime dependencies, optimized for performance
  • 📦 Multi-Platform Support - Targets .NET Framework 4.5, .NET Standard 2.0, .NET 6.0, .NET 8.0, and .NET 9.0
  • 🎯 Simple API - Easy-to-use static methods for encoding and decoding
  • 🔧 Array-Focused - Specialized for JSON array operations
  • Well-Tested - 98.31% code coverage with comprehensive unit tests using MSTest
  • 📝 Pretty Printing - Built-in JSON formatting with proper indentation
  • 🔒 No External Dependencies - Pure .NET implementation with no third-party packages
  • 📏 Tiny Package - Only 37KB package size

🚀 Installation

Install via NuGet Package Manager:

dotnet add package Proctorio.JSON

Or via Package Manager Console:

Install-Package Proctorio.JSON

🎯 Quick Start

Decoding JSON Arrays

Simple String Array
using Proctorio.JSON;

string input = "[\"philcollins\",\"Ih8PeterG\"]";
string[] result = JSONDecoders.DecodeJsStringArray(input);

// result[0]: "philcollins"
// result[1]: "Ih8PeterG"
Complex Nested Array
string input = "[14,4,[14,\"data\"],[[5,\"10.186.122.15\"],[6,\"10.186.122.16\"]]]";
string[] result = JSONDecoders.DecodeJSONArray(input);

// result[0]: "14"
// result[1]: "4"
// result[2]: "[14,\"data\"]"
// result[3]: "[[5,\"10.186.122.15\"],[6,\"10.186.122.16\"]]"

// Decode nested arrays
string[] nested = JSONDecoders.DecodeJSONArray(result[3]);
// nested[0]: "[5,\"10.186.122.15\"]"
// nested[1]: "[6,\"10.186.122.16\"]"

Encoding JSON Arrays

String Array Encoding
string[] items = new[] { "hello", "world", "test" };
string result = JSONEncoders.EncodeJsStringArray(items);
// Result: ["hello","world","test"]
Object Array Encoding
public class Person
{
    public string Name { get; set; }
    public int Age { get; set; }

    public override string ToString()
    {
        return $"[{Age},{JSONEncoders.EncodeJsString(Name)}]";
    }
}

var people = new[]
{
    new Person { Name = "Alice", Age = 30 },
    new Person { Name = "Bob", Age = 25 }
};

string result = JSONEncoders.EncodeJsObjectArray(people);
// Result: [[30,"Alice"],[25,"Bob"]]

Pretty Printing

using Proctorio.JSON.Pretty;

string input = "[14,4,[14,\"data\"],[[5,\"10.186.122.15\"],[6,\"10.186.122.16\"]]]";
string pretty = input.PrettyPrintJson();

Output:

[
   14,
   4,
   [
      14,
      "data"
   ],
   [
      [
         5,
         "10.186.122.15"
      ],
      [
         6,
         "10.186.122.16"
      ]
   ]
]

📚 API Reference

JSONDecoders

Method Description
DecodeJSONArray(string s) Decodes a complex JSON array with nested structures
DecodeJsStringArray(string s) Decodes a simple JSON string array
DecodeJsString(string s) Decodes a JSON-encoded string with escape sequences

JSONEncoders

Method Description
EncodeJsStringArray(string[] s) Encodes a string array with proper escaping
EncodeJsObjectArray(object[] s) Encodes an object array (uses ToString())
EncodeJsObjectList<T>(List<T> s) Encodes a generic list (uses ToString())
EncodeJsString(string s) Encodes a single string with JSON escaping

Extensions

Method Description
string.PrettyPrintJson() Formats JSON with proper indentation
string.Slice(int start, int end) Python-like string slicing (supports negative indices)

🔧 Why Proctorio.JSON?

Comparison with Other Libraries

Feature Proctorio.JSON Json.NET System.Text.Json
Runtime Dependencies Zero Multiple None (built-in)
Package Size Minimal (~35KB) Large (~700KB) Built-in
Array Focus
Simple API ⚠️
.NET Framework 4.5
Performance Fast Medium Fast
Memory Footprint Minimal Large Medium

When to use Proctorio.JSON:

  • You need simple JSON array encoding/decoding
  • You want zero runtime dependencies
  • You're working with legacy .NET Framework projects
  • You need a tiny package size
  • You don't need complex object serialization
  • You want minimal memory overhead

When to use alternatives:

  • You need full JSON object serialization
  • You need LINQ-to-JSON capabilities
  • You need streaming JSON parsing

🛠️ Development

Building from Source

git clone https://github.com/proctorio/json.git
cd json
dotnet build

Running Tests

dotnet test

Running Tests with Coverage

dotnet test --collect:"XPlat Code Coverage"

📊 Code Coverage

Current code coverage: 98.31%

  • Line coverage: 98.31% (175/178)
  • Branch coverage: 97.71% (169/173)
  • Method coverage: 100% (12/12)

🤝 Contributing

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

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

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

🙏 Credits

📮 Support


Made with ❤️ by Proctorio

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 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 is compatible.  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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.
  • .NETFramework 4.5

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.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
3.1.0 244 12/4/2025