Show / Hide Table of Contents

Class JsonLocation

Represents the location of a specific JSON value within a root JSON value.

Inheritance
System.Object
JsonLocation
Implements
System.IEquatable<JsonLocation>
System.IComparable<JsonLocation>
System.Collections.Generic.IEnumerable<JsonLocationNode>
System.Collections.IEnumerable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: JsonCons.JsonPath
Assembly: JsonCons.JsonPath.dll
Syntax
public sealed class JsonLocation : IEquatable<JsonLocation>, IComparable<JsonLocation>, IEnumerable<JsonLocationNode>, IEnumerable

Constructors

| Improve this Doc View Source

JsonLocation(JsonLocationNode)

Constructs a normalized path from the last location node.

Declaration
public JsonLocation(JsonLocationNode lastNode)
Parameters
Type Name Description
JsonLocationNode lastNode

Properties

| Improve this Doc View Source

Last

Gets the last node of the JsonLocation.

Declaration
public JsonLocationNode Last { get; }
Property Value
Type Description
JsonLocationNode

Methods

| Improve this Doc View Source

CompareTo(JsonLocation)

Compares this instance with a specified JsonLocation object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified JsonLocation.

Declaration
public int CompareTo(JsonLocation other)
Parameters
Type Name Description
JsonLocation other

The JsonLocation to compare with this instance.

Returns
Type Description
System.Int32

A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as other.

| Improve this Doc View Source

ContainsValue(JsonElement)

Looks for a value within the root value that matches this normalized path, returning true if such a value exists, false otherwise.

Declaration
public bool ContainsValue(JsonElement root)
Parameters
Type Name Description
System.Text.Json.JsonElement root

The root value.

Returns
Type Description
System.Boolean

true if the value was found, false otherwise.

| Improve this Doc View Source

Equals(JsonLocation)

Determines whether this instance and another specified JsonLocation object have the same value.

Declaration
public bool Equals(JsonLocation other)
Parameters
Type Name Description
JsonLocation other

The JsonLocation to compare to this instance.

Returns
Type Description
System.Boolean

true if the value of other is the same as the value of this instance; otherwise, false. If other is null, the method returns false.

| Improve this Doc View Source

Equals(Object)

Determines whether this instance and a specified object, which must also be a JsonLocation object, have the same value.

Declaration
public override bool Equals(object other)
Parameters
Type Name Description
System.Object other

The JsonLocation to compare to this instance.

Returns
Type Description
System.Boolean

true if other is a JsonLocation and its value is the same as this instance; otherwise, false. If other is null, the method returns false.

Overrides
System.Object.Equals(System.Object)
| Improve this Doc View Source

GetEnumerator()

Returns an enumerator that iterates through the components of the normalized path.

Declaration
public IEnumerator<JsonLocationNode> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<JsonLocationNode>
| Improve this Doc View Source

GetHashCode()

Returns the hash code for this JsonLocation.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

A 32-bit signed integer hash code.

Overrides
System.Object.GetHashCode()
| Improve this Doc View Source

ToJsonPointer()

Gets a JSON Pointer representation for the normalized path. The string will have the form /aName/anotherName/anIndex with any '~' and '/' characters appearing in names escaped as per the specification.

Declaration
public string ToJsonPointer()
Returns
Type Description
System.String
| Improve this Doc View Source

ToString()

Gets a string representation for the normalized path. The string will have the form $['aName']['anotherName'][anIndex] with any single quote characters appearing in names escaped with a backslash.

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()
| Improve this Doc View Source

TryGetValue(JsonElement, out JsonElement)

Looks for a value within the root value that matches this normalized path, returning true if such a value exists, false otherwise. When the value exists element is assigned that value.

Declaration
public bool TryGetValue(JsonElement root, out JsonElement element)
Parameters
Type Name Description
System.Text.Json.JsonElement root

The root value.

System.Text.Json.JsonElement element

Receives the value.

Returns
Type Description
System.Boolean

true if the value was found, false otherwise.

Explicit Interface Implementations

| Improve this Doc View Source

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

Implements

System.IEquatable<T>
System.IComparable<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX