Home JsonPointer Class
JsonPointer Class
Cancel

JsonPointer Class

Namespace: Json.Pointer

Inheritance: JsonPointer 🡒 object

Implemented interfaces:

  • IEquatable<JsonPointer>

Represents a JSON Pointer IAW RFC 6901.

Fields

NameTypeSummary
EmptyJsonPointerThe empty pointer.

Properties

NameTypeSummary
SegmentsPointerSegment[]Gets the collection of pointer segments.

Methods

Combine(JsonPointer other)

Concatenates a pointer onto the current pointer.

Declaration

1
public JsonPointer Combine(JsonPointer other)
ParameterTypeDescription
otherJsonPointerAnother pointer.

Returns

A new pointer.

Combine(params PointerSegment[] additionalSegments)

Concatenates additional segments onto the current pointer.

Declaration

1
public JsonPointer Combine(params PointerSegment[] additionalSegments)
ParameterTypeDescription
additionalSegmentsparams PointerSegment[]The additional segments.

Returns

A new pointer.

Create(params PointerSegment[] segments)

Creates a new JSON Pointer from a collection of segments.

Declaration

1
public static JsonPointer Create(params PointerSegment[] segments)
ParameterTypeDescription
segmentsparams PointerSegment[]A collection of segments.

Returns

The JSON Pointer.

Remarks

This method creates un-encoded pointers only.

Create(IEnumerable<PointerSegment> segments)

Creates a new JSON Pointer from a collection of segments.

Declaration

1
public static JsonPointer Create(IEnumerable<PointerSegment> segments)
ParameterTypeDescription
segmentsIEnumerable<PointerSegment>A collection of segments.

Returns

The JSON Pointer.

Create(Expression<Func<T, object>> expression, PointerCreationOptions options)

Generates a JSON Pointer from a lambda expression.

Declaration

1
public static JsonPointer Create(Expression<Func<T, object>> expression, PointerCreationOptions options)
ParameterTypeDescription
expressionExpression<Func<T, object>>The lambda expression which gives the pointer path.
optionsPointerCreationOptions(optional) Options for creating the pointer.

Returns

The JSON Pointer.

Equals(JsonPointer other)

Indicates whether the current object is equal to another object of the same type.

Declaration

1
public bool Equals(JsonPointer other)
ParameterTypeDescription
otherJsonPointerAn object to compare with this object.

Returns

true if the current object is equal to theother parameter; otherwise, false.

Equals(object obj)

Indicates whether this instance and a specified object are equal.

Declaration

1
public override bool Equals(object obj)
ParameterTypeDescription
objobjectThe object to compare with the current instance.

Returns

true ifobj and this instance are the same type and represent the same value; otherwise, false.

Evaluate(JsonElement root)

Evaluates the pointer over a System.Text.Json.JsonElement.

Declaration

1
public JsonElement? Evaluate(JsonElement root)
ParameterTypeDescription
rootJsonElementThe System.Text.Json.JsonElement.

Returns

The sub-element at the pointer’s location, or null if the path does not exist.

GetHashCode()

Returns the hash code for this instance.

Declaration

1
public override int GetHashCode()

Returns

A 32-bit signed integer that is the hash code for this instance.

Parse(string source)

Parses a JSON Pointer from a string.

Declaration

1
public static JsonPointer Parse(string source)
ParameterTypeDescription
sourcestringThe source string.

Returns

A JSON Pointer.

ToString()

Returns the string representation of this instance.

Declaration

1
public override string ToString()

Returns

The string representation.

ToString(JsonPointerStyle pointerStyle)

Returns the string representation of this instance.

Declaration

1
public string ToString(JsonPointerStyle pointerStyle)
ParameterTypeDescription
pointerStyleJsonPointerStyleIndicates whether to URL-encode the pointer.

Returns

The string representation.

TryEvaluate(JsonNode root, out JsonNode result)

Evaluates the pointer over a System.Text.Json.Nodes.JsonNode.

Declaration

1
public bool TryEvaluate(JsonNode root, out JsonNode result)
ParameterTypeDescription
rootJsonNodeThe System.Text.Json.Nodes.JsonNode.
resultout JsonNodeThe result, if return value is true; null otherwise

Returns

true if a value exists at the indicate path; false otherwise.

TryParse(string source, out JsonPointer pointer)

Parses a JSON Pointer from a string.

Declaration

1
public static bool TryParse(string source, out JsonPointer pointer)
ParameterTypeDescription
sourcestringThe source string.
pointerout JsonPointerThe resulting pointer.

Returns

true if the parse was successful; false otherwise.

Contents