Simple and fast in-memory JSON manipulation
What is KGySoft.Json
First of all, what it is not: It’s not a serializer (though see the Examples section of the
JsonValue type). It is rather a simple Domain Object Model (DOM) for JSON (or LINQ to JSON if you like), which makes possible to manipulate JSON content in memory in an object-oriented way (similarly to
XDocument and its friends for XML).
What’s wrong with JSON.NET?
Nothing. It knows everything (and more). It was just too heavy-weight for my needs and I didn’t like that a lot of libraries reference different versions of it, causing version conflicts. Note though that it’s not the fault of JSON.NET; it’s just the consequence of popularity (the same could be true even for this library if it was so popular… but I don’t really think it could be a real issue anytime soon).
What’s wrong with System.Text.Json?
Well, it’s a bit different thing. As an in-memory JSON tool, it is read-only (
JsonElement) so you cannot build in-memory JSON content with it. It was introduced with .NET Core 3.0, so below that you have to use NuGet packages, which may lead to the same issue as above (but even with NuGet, it’s not supported below .NET Framework 4.6.1). Apart from those issues, it’s really fast, and mostly allocation free (well, as long as your source is already in UTF8 and you don’t access string elements).
In Visual Studio
The preferred way is by the NuGet Package Manager in Visual Studio
- You can use either the Package Manager Console:
PM> Install-Package KGySoft.Json
- Or the Package Manger GUI by the Manage NuGet Packages… context menu item of the project.
Tip: See also the examples at the Remarks section of the
Browse the online documentation for examples and detailed descriptions.
This repository is under the KGy SOFT License 1.0, which is a permissive GPL-like license. It allows you to copy and redistribute the material in any medium or format for any purpose, even commercially. The only thing is not allowed is to distribute a modified material as yours: though you are free to change and re-use anything, do that by giving appropriate credit. See the LICENSE file for details.