Home JsonPointer.Net



Fixed a problem with .ToString() where pointers constructed using JsonPointer.Create() would not properly escape segments.


For some reason v5.0.0 was missing two methods: .GetAncestor() and .GetLocal(). This is a republish to include those methods.


Complete overhaul of JsonPointer to reduce memory usage for consuming applications.

Benchmark showing performance of parsing various pointer strings before and after changes.

VersionCountMeanErrorStdDevGen0Allocated us0.2559 us0.7300 us4.63879.48 KB us0.0492 us0.0460 us2.25834.62 KB
4.0.11054.627 us1.0469 us2.9355 us46.386794.77 KB
5.0.01031.482 us0.4489 us0.4199 us22.583046.17 KB
4.0.1100537.704 us10.6843 us22.5369 us463.8672947.66 KB
5.0.0100329.112 us2.6580 us2.4863 us226.0742461.72 KB

Architecture change

JsonPointer is now a struct which holds the complete pointer string. Segments are now exposed via an indexer and return ReadOnlySpan<char>s which contain the JSON-Pointer-encoded segment. Use JsonPointer.SegmentEquals() for zero-allocation string comparisons or the .GetSegmentName() to decode to a string.

RelativeJsonPointer as likewise been updated to a struct.

Breaking changes

  • JsonPointer is now a struct.
  • JsonPointer.Segments removed.
  • JsonPointer.Create(IEnumerable<PointerSegment>) removed.
  • PointerSegment is now only an intermediary type for building pointers; non-constructable.
  • RelativeJsonPointer is now a struct.
  • EnumerableExtensions.GetCollectionHashCode<T>() removed.


  • JsonPointer segment indexer
  • JsonPointer.SegmentEquals(ReadOnlySpan<char>, string)
  • JsonPointer.GetAncestor(int) (gets left part)
  • JsonPointer.GetLocal(int) (gets right part)
  • NodeExtensions.TryGetSegment() extension on JsonObject to find a key using a JSON-Pointer-encoded char span.
  • SpanExtensions
    • GetSegmentName() decodes a pointer segment char span into a string name
    • GetSegmentIndex() decoes a pointer segment char span into an integer index
    • TryGetInt() attempts to parse an integer from a char span


#711 - Nuget package meta-data updates; no functional changes from previous version.


Fixed issue with equality operators on PointerSegment when dealing with nulls.


Updated for multi-framework support with .Net Standard 2.0 and .Net 8 with Native AOT support, including updating System.Text.Json from v6 to v8.

Breaking changes

  • Dropping support for .Net Standard 3.1 - May still be used, but exact behavior cannot be guaranteed.
  • CharExtensions removed as it was not used.


JsonPointer.TypeInfoResolver to expose all of the type resolvers contained in the library. Can be used to create a combined SerializationOptions by using a Json.More.TypeResolverOptionsManager in your JsonSerializerContext.


#585 - Added support for TypeConverter so that an application config can properly convert to JSON Pointer in config models. Thanks to @wazzamatazz for raising the issue and providing the implementation.


Implemented support for index modifiers for Relative JSON Pointers (e.g. the +1 in 0+1/foo), which apparently just weren’t supported.


#555 - JSON Pointer creation using Linq expressions should support using local variables in indexers. Thanks to @OmiCron07 for suggesting.


#549 - Expose JSON converters for all types to support JSON source generation.


Enhanced support for creating pointers via Linq expressions.

  • Added support for the Linq method .Last() to generate a - segment which indicates the index beyond the last item in an array.
  • Added support for [JsonPropertyName] attribute.
  • Added support for custom naming transformations.


Improved performance for JsonPointer.ToString() by caching the string representation so that it’s only generated once.


Memory and performance improvements.


#408 - Fixed an issue where an empty string segment fails for array values. Thanks to @mbj2011 for finding and reporting this.


Updated model to more correctly represent a basic JSON Pointer.

  • URL encoding is merely a formatting concern
  • Removed UrlEmpty
  • Parse() and TryParse() are still tolerant of URL encoded pointers and will decode automatically
  • Removed Source property as ToString() is the default method for getting a string
  • Renamed JsonPointerKind to JsonPointerStyle to reflect the formatting nature of its purpose
  • Added ToString(JsonPointerKind) to support outputting in URL encoded format

Added implicit cast from int to PointerSegment. Previously, only a cast from uint existed, but typing ints is easier.

2.2.1 (no PR)

#288 - Just bumping version to allow dependent packages to pick up the latest Json.More.Net by default, which is transitively pulled via this package.


Updated System.Text.Json to version 6 in order to add JsonNode support.

The API is shaped a bit differently for JsonNode than the existing API for JsonElement. Specifically, it exposes

bool TryEvaluate(JsonNode node, out JsonNode? result)

instead of the Evaluate() call you’ve all come to know and love.

This is because .Net decided to do a silly thing and represent JSON null using .Net null. This decision means that a null returned here cannot be distinguished between not existing and existing with a value of JSON null.

RelativeJsonPointer is now implemented! …for JsonNode.


#184 - @JanKnipp added array (e.g. int[]) support to Linq expression construction of pointers.


#171 - Updated JsonPointer, PointerSegment, and RelativeJsonPointer from struct to class since it holds by-reference data anyway. Removes parameterless constructor for these types. These changes make them better immutable models.


  • Added implicit casts from int and string to PointerSegment
  • Added params overload for JsonPointer.Create().


#123 - Removed a copy/paste error that shows up while deserializing relative pointers. Thanks to @bastiaantenklooster for finding this and creating a PR to fix it.


Added support for nullable reference types.


Signed the DLL for strong name compatibility.


Added support pointer creation using lambda expressions, e.g. x => x.foo[5].bar to create /foo/5/bar.


Added support for array index manipulation in Relative JSON Pointer 2 (spec updated alongside JSON Schema Draft 2020-12).


Added debug symbols to package. No functional change.


Updated reference to Json.More.Net.


Added JsonPointerKind enumeration.

Added JsonPointer.Kind property.

Added optional parameters to JsonPointer.Parse() and JsonPointer.TryParse().


Initial release.