Skip to content
CAI
Software that uses CAICheck a score

JamesNK/Newtonsoft.Json

61.4

Adequate · 23 September 2026

62k

lines of production code

C#

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is the Json.NET library, a comprehensive tool for serializing and deserializing JSON data in .NET applications. It provides robust APIs for object serialization with extensive configuration options, LINQ to JSON for querying and manipulating JSON structures, and support for alternative formats like BSON and XML conversion. The library also includes a rewritten JSONPath engine for advanced data filtering and a pluggable naming strategy system for flexible property name handling.

How it got here

2007–2008 — SDK migration and serialization expansion

11 changes.

The project modernized its build infrastructure by migrating to SDK-style project files and centralizing configuration, while adding support for .NET 10. Concurrently, it expanded the serialization engine with new configuration enums, LINQ to JSON enhancements, and a wide array of converters for ADO.NET, F\#, and custom object creation. This period also emphasized robustness through comprehensive unit testing and fuzzing suites.

2009–2010 — BSON support and naming strategies

11 changes.

This period focused on expanding format support with the introduction of BSON serialization and enhancing serialization flexibility through a pluggable NamingStrategy abstraction. The work was accompanied by significant infrastructure updates, including a new build pipeline with code signing, and comprehensive test coverage for the new features and existing utilities.

2012–2013 — Documentation samples and JSONPath rewrite

13 changes.

This period focused on expanding the library's documentation by adding over 100 executable code samples for core features like LINQ to JSON, serialization, and BSON, accompanied by comprehensive test coverage to ensure their correctness. Simultaneously, the JSONPath query engine was completely rewritten to support advanced features such as array slicing, strict equality operators, and regex matching, with extensive new tests validating the enhanced query capabilities.

2014–2017 — Performance benchmarking and test expansion

4 changes.

This period focused on establishing rigorous performance measurement through the introduction of BenchmarkDotNet-based console applications and serialization benchmarks. Concurrently, the project significantly expanded its test suite to cover async reading, error handling, and a wide array of serialization edge cases and type-specific scenarios.

Features

Added documentation for Json.NET code samples

A new documentation file (Samples.aml) has been added to the Doc/Samples directory, introducing users to over 100 code samples covering core Json.NET functionality. The entry outlines key topics including serializing JSON, LINQ to JSON, JSON Schema (with a note that validation has moved to a separate package), converting XML, BSON, and reading/writing JSON.

Doc/Samples · high confidence

Added documentation samples for custom JSON readers/writers and multi-content reading

New documentation topics have been added to the samples library, providing code examples for creating custom JsonReader and JsonWriter implementations, using JsonTextReader and JsonTextWriter for standard read/write operations, and enabling the SupportMultipleContent property to read multiple JSON fragments from a stream or text reader.

Doc/Samples/Json · high confidence

Added performance benchmarking console application

A new test console application has been added to run performance benchmarks using BenchmarkDotNet. The application is configured to allow very large GC objects and executes benchmarks defined in the LowLevelBenchmarks class, providing a way to measure and track performance improvements.

Src/Newtonsoft.Json.TestConsole · high confidence

Initial support for reading and writing BSON format

Added the BsonReader and BsonWriter classes to enable serialization and deserialization of Binary JSON (BSON) data. This includes support for BSON-specific types such as ObjectIds, binary data with subtype handling (including UUIDs), and regular expressions, along with configuration options for DateTime handling and legacy binary compatibility.

Src/Newtonsoft.Json/Bson · high confidence

Introduction of NamingStrategy abstraction and CamelCase implementation

The serialization engine now uses a pluggable NamingStrategy abstraction to control how property names and dictionary keys are resolved during serialization and deserialization. This change introduces the base NamingStrategy class along with a DefaultNamingStrategy (which leaves names unchanged) and a CamelCaseNamingStrategy (which converts names to camelCase). The CamelCaseNamingStrategy supports options to process dictionary keys, override explicitly specified property names, and process extension data names. The DefaultContractResolver now accepts a NamingStrategy instance, allowing users to configure naming conventions without subclassing the resolver. This provides a more flexible and consistent way to handle naming transformations across the library.

Src/Newtonsoft.Json/Serialization · high confidence

New LINQ to JSON and Serializer documentation samples

Added a comprehensive set of new documentation samples in the Doc/Samples directory, covering LINQ to JSON operations (such as parsing, querying, cloning, and converting) and Serializer features (including custom converters, contract resolvers, and handling settings). These samples provide copy-pasteable C\# code snippets to help users understand how to use specific Json.NET APIs.

Doc/Samples/Serializer · high confidence

New LINQ to JSON configuration enums and extension methods

The LINQ to JSON API now includes the CommentHandling and DuplicatePropertyNameHandling enums, allowing users to control how JSON comments are loaded and how duplicate property names are resolved (replace, ignore, or error). Additionally, the Extensions class provides new LINQ-style methods such as Ancestors, Descendants, Properties, and Values to simplify querying and traversing JToken trees.

Src/Newtonsoft.Json/Linq · high confidence

New and updated JSON converters for ADO.NET, F\#, and custom object creation

The \Src/Newtonsoft.Json/Converters\ directory now includes several new and updated converter implementations. \BinaryConverter\ handles conversion between binary values and base64 strings, supporting \System.Data.Linq.Binary\ and \SqlBinary\. \DataSetConverter\ and \DataTableConverter\ manage serialization of ADO.NET datasets and tables, with \DataTableConverter\ now using the serializer for cell data and supporting nested DataTables. \CustomCreationConverter\ provides a generic base class for creating custom objects during deserialization. \DateTimeConverterBase\ serves as an abstract base for DateTime conversions. \DiscriminatedUnionConverter\ adds support for serializing and deserializing F\# discriminated unions. \EntityKeyMemberConverter\ handles Entity Framework \EntityKeyMember\ types, restricting type names to supported values. \ExpandoObjectConverter\ deserializes JSON into \ExpandoObject\ instances. \BsonObjectIdConverter\ is marked obsolete as BSON support moves to a separate package.

Src/Newtonsoft.Json/Converters · high confidence

New documentation topics for serialization, LINQ to JSON, and performance

The documentation has been expanded with new conceptual articles covering key Json.NET capabilities. Users can now find dedicated guides on conditional property serialization (ShouldSerialize and IContractResolver), custom object creation during deserialization, and JSON Schema validation. Additional topics explain LINQ to JSON usage, including parsing, creating, and querying JSON structures, as well as converting between JSON and XML. A new performance guide provides best practices for reusing contract resolvers, optimizing memory usage, and using converters efficiently.

Doc · high confidence

New internal utility classes for async operations, base64 encoding, and primitive caching

The library introduces several new internal utility classes in the Utilities folder to support modern .NET features and performance optimizations. AsyncUtils provides helper methods for asynchronous cancellation and task completion checks, ensuring compatibility across different .NET versions. Base64Encoder adds support for asynchronous base64 encoding operations. BoxedPrimitives implements a caching strategy for common primitive values (booleans, small integers, special doubles) to reduce memory allocations. BidirectionalDictionary offers a generic two-way mapping structure. CollectionWrapper provides a unified wrapper for both generic and non-generic collections. ConvertUtils expands type conversion support to include newer .NET types like Half, Int128, and UInt128. DateTimeParser is a new high-performance parser for ISO 8601 date-time strings.

Src/Newtonsoft.Json/Utilities · high confidence

New serialization configuration enums and compatibility suppressions

The library introduces several new enumeration types to give users finer control over serialization and deserialization behavior: \ConstructorHandling\ allows using non-public default constructors, \DefaultValueHandling\ controls whether default values are included or populated, \FloatFormatHandling\ determines how special floating-point values (NaN, Infinity) are written, and \FloatParseHandling\ specifies whether floats are parsed as \double\ or \decimal\. Additionally, \DateFormatHandling\, \DateParseHandling\, and \DateTimeZoneHandling\ provide explicit control over date formatting, parsing targets, and time-zone conversion. A new \DefaultJsonNameTable\ implementation is added to optimize string interning, and \CompatibilitySuppressions.xml\ is introduced to manage API differences between .NET 2.0 and 3.5 builds during package validation.

Src/Newtonsoft.Json · high confidence

Rewritten JSONPath engine with expanded query capabilities

The JSONPath implementation in \Src/Newtonsoft.Json/Linq/JsonPath\ has been completely rewritten to support a richer set of query features. Users can now use array slicing syntax (e.g., \\[start:end:step\]\), multiple index accessors (e.g., \\[0, 2\]\), and multiple property selectors (e.g., \\['name', 'age'\]\). The query language now includes strict equality (\==\) and inequality (\!=\) operators, as well as a regex match operator (\=\~\) for pattern matching. Additionally, the engine supports recursive descent queries (\..\) and root object references within filter expressions, providing more precise control over JSON data traversal and filtering.

Src/Newtonsoft.Json/Linq/JsonPath · high confidence

Architecture

Migrate solution format and centralize build configuration

The project has migrated from the legacy .sln format to the new .slnx solution format, which now explicitly references the core library, tests, fuzz tests, and test console projects. Build configuration has been centralized via a new Directory.Build.props file that defines shared package versions for dependencies such as NUnit, xUnit, Moq, and Autofac, while global.json has been updated to target .NET SDK 10.0.300 with latestFeature roll-forward enabled. Additionally, a NuGet.Config file has been added to configure package sources, ensuring consistent dependency resolution across the solution.

Src · high confidence

Behavioural changes

Documentation samples for JsonSchema marked as obsolete

The documentation samples in the Doc/Samples/Schema directory (including CreateJsonSchemaManually, JTokenIsValid, JsonSchemaParse, and others) have been updated to include a caution alert stating that the Newtonsoft.Json.Schema functionality is obsolete. Users are now directed to the separate JsonSchema package at https://www.newsoft.com/jsonschema for JSON Schema validation features.

Doc/Samples/Schema · high confidence

JSON Schema validation moved to a separate package

The built-in JSON Schema validation types in \Newtonsoft.Json.Schema\ (including \JsonSchema\, \JsonSchemaGenerator\, \Extensions\, and related internal builders) are now marked as obsolete. The schema validation functionality has been extracted into its own dedicated package; users should migrate to the new package for continued support.

Src/Newtonsoft.Json/Schema · high confidence

New build infrastructure with code signing and .NET 10 support

The build system has been replaced with a new PowerShell-based pipeline (build.ps1) that targets .NET 10.0 alongside .NET 8.0, 6.0, and legacy frameworks (4.5, 4.0, 3.5, 2.0). This update introduces automated NuGet package signing via Azure Key Vault using the SignClient service, configurable via environment variables and appsettings.json. Versioning is now managed through a central version.json file, and the build process utilizes the new .slnx solution format.

Build · high confidence

Updated license, versioning, and assembly visibility attributes

The assembly metadata in Newtonsoft.Json has been updated to use the MIT license instead of the previous Creative Commons Attribution 2.5 license, and the assembly version has been bumped to 1.3.0.0. The build now conditionally applies the AllowPartiallyTrustedCallers attribute for .NET 2.0, 3.5, and 4.0 targets. Additionally, InternalsVisibleTo declarations for the Schema, Tests, and Dynamic projects now include public keys when the assembly is signed, and the assembly is explicitly marked as CLS-compliant.

Src/Newtonsoft.Json/Properties · high confidence

Test coverage

Added BenchmarkDotNet performance benchmarks for serialization and deserialization; Added LINQ to JSON and JsonPath documentation samples; Added LINQ to JSON unit tests; Added comprehensive test coverage for BSON reader and writer; Added comprehensive unit tests for JSON Schema validation and generation; Added documentation example tests; Added documentation sample tests for JSON reading, writing, and custom readers/writers; Added documentation samples for JsonSchema usage; Added fuzzing and regression test suites for JSON parsing robustness; Added serializer documentation samples and tests; Added test fixture classes for serialization scenarios; Added tests for BSON serialization and deserialization samples; Added tests for JSON-to-XML and XML-to-JSON conversion samples; Added tests for LINQ to SQL serialization; Added unit tests for JSON utilities and reflection factories; Added unit tests for built-in JSON converters; Added unit tests for serialization naming strategies and contract resolvers; Expanded test coverage for JSON serialization and deserialization edge cases; Expanded test coverage for JSONPath query execution and parsing; Expanded test coverage for JsonTextReader async and error-handling scenarios; Updated test assembly metadata and license header.

Dependencies

Migrate to SDK-style project files and add .NET 10 support

The project files for the core library, tests, fuzz tests, and test console have been converted from legacy MSBuild formats to the modern SDK-style (Microsoft.NET.Sdk). This migration introduces support for .NET 10.0 across the library and test suites, alongside .NET 8.0 and .NET 6.0. The test project has been updated to use xUnit for .NET 8.0 targets while retaining NUnit for legacy frameworks, and the core library now includes package validation, source link, and trim/AOT compatibility analyzers.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 60 → 61 (+1.7)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 86 → 81 (-5.0)
  • Architecture 97 → 97 (+0.1)
  • Maturity 53 → 49 (-4.2)
  • Readiness 60 → 67 (+7.1)
  • Security 59 → 72 (+13.6)
  • Performance 78 → 79 (+0.4)

Resolved (38)

  • BarePragmaDisable (Src/Newtonsoft.Json.Tests/FuzzRegressionTests.cs)
  • BarePragmaDisable (Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs)
  • BarePragmaDisable (Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs)
  • BarePragmaDisable (Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs)
  • BarePragmaDisable (Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs)
  • Bounded contexts not declared
  • Duplicated block (10 lines × 2) (Src/Newtonsoft.Json/JsonTextReader.cs)
  • Duplicated block (12 lines × 2) (Src/Newtonsoft.Json/JsonTextReader.cs)
  • Duplicated block (13 lines × 2) (Src/Newtonsoft.Json/JsonReader.cs)
  • Duplicated block (15 lines × 2) (Src/Newtonsoft.Json/Linq/JValue.cs)
  • Duplicated block (15 lines × 4) (Src/Newtonsoft.Json/Linq/JValue.cs)
  • Duplicated block (19 lines × 2) (Src/Newtonsoft.Json/JsonTextReader.cs)
  • Duplicated block (22 lines × 2) (Src/Newtonsoft.Json/JsonTextReader.cs)
  • Duplicated block (24 lines × 2) (Src/Newtonsoft.Json/JsonTextReader.cs)
  • Duplicated block (24 lines × 2) (Src/Newtonsoft.Json/Utilities/MathUtils.cs)
  • Duplicated block (7 lines × 2) (Src/Newtonsoft.Json/Linq/JsonPath/QueryExpression.cs)
  • Further sole-owners (lower concentration)
  • HackComment (Src/Newtonsoft.Json/JsonWriter.cs)
  • High CVE: System.Net.Http 4.1.0
  • High CVE: System.Net.Http 4.3.0
  • …and 18 more

New (138)

  • BarePragmaDisable (Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs)
  • BarePragmaDisable (Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs)
  • BarePragmaDisable (Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs)
  • BarePragmaDisable (Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs)
  • BareSuppressMessage (Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs)
  • CommentedOutCode (Src/Newtonsoft.Json.Tests/Serialization/ShouldSerializeTests.cs)
  • CommentedOutCode (Src/Newtonsoft.Json.Tests/Serialization/ShouldSerializeTests.cs)
  • ConvertUtils.ToBigInteger (cognitive 18) (Src/Newtonsoft.Json/Utilities/ConvertUtils.cs)
  • ConvertUtils.ToBigInteger (cyclomatic 22) (Src/Newtonsoft.Json/Utilities/ConvertUtils.cs)
  • ConvertUtils.TryConvertModernNumber (cognitive 22) (Src/Newtonsoft.Json/Utilities/ConvertUtils.cs)
  • ConvertUtils.TryConvertModernNumber (cyclomatic 20) (Src/Newtonsoft.Json/Utilities/ConvertUtils.cs)
  • Dead code: CastInstance (Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs)
  • Dead code: Cat (Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs)
  • Dead code: CreateChildrenCollection (Src/Newtonsoft.Json/Linq/JContainer.cs)
  • Dead code: GetPerson (Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs)
  • Dead code: SetDynamicCodeGeneration (Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs)
  • DeadPreprocessorBranch (Src/Newtonsoft.Json.Tests/Benchmarks/Runner.cs)
  • DeadPreprocessorBranch (Src/Newtonsoft.Json.Tests/JsonConvertTest.cs)
  • DeadPreprocessorBranch (Src/Newtonsoft.Json.Tests/Utilities/ConvertUtilsTests.cs)
  • DeadPreprocessorBranch (Src/Newtonsoft.Json/FormatterAssemblyStyle.cs)
  • …and 118 more

Changes since last survey

  • 19 commits — 12 feature/other, 7 fixes

By area

  • Src/Newtonsoft.Json — 13 commits
  • Src/Newtonsoft.Json.Tests — 3 commits
  • Build/version.json — 2 commits
  • Doc/cross.png — 1 commit

Notable commits

  • fix: Fix default value population for renamed constructor parameters (#3120)
  • fix: Fix error message displayed when a property marked as DisallowNull is set to null (#3081)
  • fix: Fix memory required message test (#3131)
  • fix: Fix quadratic JObject duplicate property handling (#3123)
  • fix: Revert "Fix MissingMethodException from JToken.ToString(Formatting) (#3092)"
  • fix: Revert "Fix MissingMethodException from JToken.WriteTo (#3104)"
  • fix: fix: use read async with cancel token when available (#3126)
  • change: Add .NET 10 target and modern numeric and memory support (#3130)
  • change: Add support for C# union types (#3133)
  • change: Ran lossless compression on 3 of the repo's PNG files. (#3110)
  • change: Reduce allocations in ToMultidimensionalArray (#3093)
  • change: Remove .NET Standard 1.x support (#3125)
  • change: Restrict EntityKeyMember type name to supported values (#3121)
  • change: Trim disabled dynamic serializer paths (#3132)
  • change: Update version
  • change: Update version to 14.0.1-beta1
  • change: Use a safer method for detecting negative zero (#3094)
  • change: Validate $type metadata values during deserialization (#3111)
  • change: Validate BSON binary data lengths before allocation (#3122)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

JamesNK/Newtonsoft.Json was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 23 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 52fa3aef1f2cadcd3a3f874251eddc98d3efbbaa — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-955b9cee9818.