Skip to main content
net8.0.NETStandard2.0

JSON Pointer built on the System.Text.Json namespace

Published
Apr 19, 2024
2y ago
Total Downloads
101.0M
100,966,646

Install

dotnet add package JsonPointer.Net --version 4.0.1.3
ProductVersions
.NET
net8.0
.NET Standard
netstandard2.0

README

Summary

JsonPointer.Net implements the JSON Pointer specification RFC 6901, a string syntax for identifying a specific value within a JavaScript Object Notation (JSON) document.

Links

Usage

Parse a pointer:

var pointer = JsonPointer.Parse("/objects/and/3/arrays");

Build it manually:

var pointer = JsonPointer.Create("object", "and", 3, "arrays");

Or generate using an LINQ expression:

var pointer = JsonPointer.Create<MyObject>(x => x.objects.and[3].arrays);

Use the pointer to query JsonElement:

using var element = JsonDocument.Parse("{\"objects\":{\"and\":[\"item zero\",null,2,{\"arrays\":\"found me\"}]}}");
var result = pointer.Evaluate(element.RootElement);
// result: "found me"

or JsonNode:

var element = JsonNode.Parse("{\"objects\":{\"and\":[\"item zero\",null,2,{\"arrays\":\"found me\"}]}}");
var success = pointer.TryEvaluate(element, out var result);
// success: true
// result: "found me"

Changes from Previous Version

No structural changes between v4.0.1.1 and v4.0.1.3.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.