Skip to content

Gremlinq.Extensions

Gremlinq.Extensions.Support.SystemTextJson

Includes CosmosDb provider packages

Purchasing this product also grants access to the CosmosDb provider packages for ExRam.Gremlinq 13 via the paid private NuGet feed. Transition details: CosmosDb provider packages transition.

Introduction

Gremlinq.Extensions.Support.SystemTextJson is a drop-in replacement for ExRam.Gremlinq.Support.NewtonsoftJson. It delivers faster query result deserialization with lower memory pressure — and now also significantly improves the serialization side. The package includes a complete rewrite of the bytecode-serialization layer that no longer delegates to Gremlin.NET, giving you leaner, faster serialization of Gremlin queries end-to-end.

Newtonsoft.Json vs System.Text.Json

ExRam.Gremlinq.Support.NewtonsoftJson has been the default support package since Gremlinq's early days, and Newtonsoft.Json remains a perfectly valid choice. The System.Text.Json package exists for cases where its characteristics are a better fit.

System.Text.Json is part of the .NET runtime. It ships with the framework itself, which removes a third-party dependency from your project. If dependency minimisation matters to your team or your supply-chain policies, that is relevant.

The request serializer writes directly to a pooled buffer. The custom bytecode serializer uses Utf8JsonWriter with a pooled ArrayPoolBufferWriter<byte> and dispatches on value types without reflection. Gremlin.NET's serializer builds a temporary object graph first; this package skips that step entirely.

Response data is parsed into JsonElement. Server responses are represented as System.Text.Json's JsonElement — a struct backed by a single pooled JsonDocument buffer — rather than Newtonsoft's JToken tree, which allocates a separate object per node. The result is fewer heap allocations per response.

If none of those concerns apply to your project, Newtonsoft.Json works just as well.

Migrating custom type converters

If you have custom IConverterFactory implementations for deserialization — for example, the enum or value-object patterns described in Custom types — you will need to update the source type in your deserializer factories.

With ExRam.Gremlinq.Support.NewtonsoftJson the raw JSON token arrives as Newtonsoft.Json.Linq.JValue. With Gremlinq.Extensions.Support.SystemTextJson it arrives as System.Text.Json.JsonElement. The factory structure and the IConverter<TSource, TTarget> pattern are identical; only the source type of the deserializer changes.

Serializer factories (converting from your type to a graph-native primitive) are unaffected.

Setup

After setting up our NuGet package server with your license key, add the package(s) to your project

.NET CLI
dotnet add package Gremlinq.Extensions.Support.SystemTextJson

or, for ASP.NET Core projects

.NET CLI
dotnet add package Gremlinq.Extensions.Support.SystemTextJson.AspNet

Optionally, remove ExRam.Gremlinq.Support.NewtonsoftJson (resp. ExRam.Gremlinq.Support.NewtonsoftJson.AspNet) from your projects. Then, replace calls to UseNewtonsoftJson with UseSystemTextJson:

C#
source = source
    .ConfigureEnvironment(env => env
        .UseSystemTextJson());

Pricing

Developer Seats Price per seat (€) / year (excl. tax)
For the first 1 to 5 299.00
For the next 6 to 10 149.00
For the next 11 to 20 49.00
For the rest included

Need a bundled offer? Reach out at info@danielcweber.net.