Thoth.Json.System.Text.Json 0.5.0

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

Thoth.Json

Tests

JSON the simple and safe way, for F# on .NET, JavaScript and Python.

Documentation

Packages

Thoth.Json.Core holds the API. Add it, plus the package for the runtime your code targets.

Package
Thoth.Json.Core Decoders, encoders and codecs
Thoth.Json.Core.Auto Coders generated from F# types
Thoth.Json.JavaScript Fable, compiling to JavaScript
Thoth.Json.Python Fable, compiling to Python
Thoth.Json.Newtonsoft .NET, on top of Newtonsoft.Json
Thoth.Json.System.Text.Json .NET, on top of System.Text.Json

Thoth.Json and Thoth.Json.Net are the previous generation of the library. Their documentation is under the Legacy version of the site.

Benchmark

Remark

We are comparing the performance of Thoth.Json with standard JSON libraries like Newtonsoft.Json and System.Text.Json.

Thoth.Json is expected to be slower than these libraries because it uses them internally.

It is also important to note that Thoth.Json solve a different problem than these libraries. It aims to provide a cross-platform API for .NET, JavaScript, Python, etc. with a focus on the developer experience and type safety.

For most of the use cases, Thoth.Json should be fast enough, not everyone needs to parse JSON at the speed of light.

BenchmarkDotNet v0.15.8, Linux Arch Linux
Intel Core i9-14900K 0.80GHz, 1 CPU, 32 logical and 24 physical cores
.NET SDK 10.0.300
  [Host]     : .NET 10.0.8 (10.0.8, 10.0.826.23019), X64 RyuJIT x86-64-v3 DEBUG
  DefaultJob : .NET 10.0.8 (10.0.8, 10.0.826.23019), X64 RyuJIT x86-64-v3


| Method                      | Mean       | Error    | StdDev   | Ratio | RatioSD |
|---------------------------- |-----------:|---------:|---------:|------:|--------:|
| System.Text.Json            |   434.9 ns |  1.60 ns |  1.49 ns |  1.00 |    0.00 |
| Newtonsoft                  |   806.6 ns |  1.96 ns |  1.53 ns |  1.85 |    0.01 |
| Thoth.Json.System.Text.Json | 1,183.1 ns |  3.36 ns |  3.14 ns |  2.72 |    0.01 |
| Thoth.Json.Newtonsoft       | 2,072.9 ns | 13.54 ns | 12.66 ns |  4.77 |    0.03 |

Blogs post

This is to keep track of different blog post that I refer to sometimes when thinking or helping people.

Project structure

Tests

For the tests, we use a shared project Thoth.Json.Tests that is referenced by the different runners. This is because we want each runner to only have the minimum amount of dependencies, and also if we include files from outside the .fsproj folder, then some generated files by Fable escape from the specify outDir.

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

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Thoth.Json.System.Text.Json:

Package Downloads
Fable.Compiler

Package Description

Nacara.Plugin.Versions

Publish several versions of a Nacara site side by side, with a switcher.

Fickl.Compiler

Package Description

Nacara.Plugin.LiveExample

Run F# snippets in the browser, compiled by Fable as the reader edits them.

FSharp.ModelsDev

F# LLM API SDK: standalone chat client, Models.dev offline catalog, Microsoft.Extensions.AI IChatClient adapter.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.0 5,882 10/13/2026
0.4.0 29,433 6/3/2026
0.3.0 481 4/23/2026
0.2.2 1,189 10/17/2025
0.2.1 3,017 1/20/2025
0.2.0 226 11/25/2024
0.1.0 214 11/23/2024

### 🚀 Features

* Adds codecs (#247) ([d7322a4](https://github.com/thoth-org/Thoth.Json/commit/d7322a4c40cd20bd3660e60696bd3e7024f8a972))
* FronStringWithOptions overload accepting either a dedoder or codec ([7ccd3cf](https://github.com/thoth-org/Thoth.Json/commit/7ccd3cf51808359ee95ee47c30261812be829578))

### 🐞 Bug Fixes

* Disallow trailing commas by default (#243) ([058bcb6](https://github.com/thoth-org/Thoth.Json/commit/058bcb6e199293f4a77dc4da0e7fa1f4a8fe495e))
* Handle int64 and uint64 outside of float precision (#244) ([feb96ac](https://github.com/thoth-org/Thoth.Json/commit/feb96ac397da85eed4555888ae88a169af4308a6))
* Avoid reflection-based `JsonSerializer.Serialize` in STJ backend ([ddcc635](https://github.com/thoth-org/Thoth.Json/commit/ddcc635a7c8e14a7ccac30a9fb6fc296c1dd1632))

### ⚡ Performance Improvements

* Dispose the `JsonDocument` created in `Decode.fromStringWithOptions` (#256) ([4bb2199](https://github.com/thoth-org/Thoth.Json/commit/4bb2199998bf21f361290ec76cf6df09c1805b8c))
* Tweak System.Text.Json hasProperty helper (#257) ([215d504](https://github.com/thoth-org/Thoth.Json/commit/215d504c424c0d829ede93c308c4f59c545ea3ac))

<strong><small>[View changes on Github](https://github.com/thoth-org/Thoth.Json/compare/7e3cf6576d8ebb5e7655e18dc8ae97ad136cee9b..581fd36fef81aaae62cdde3bf4821d2dcbc98558)</small></strong>