JsonPathSegment

Namespace: SnowBank.Data.Json · struct

Implements: IJsonSerializable, IJsonPackable, IJsonDeserializable<JsonPathSegment>, ISpanFormattable, IFormattable, IEquatable<JsonPathSegment>, IEquatable<string>, IEquatable<Index>, IEquatable<int>, IEquatable<ReadOnlyMemory<char>>, IEquatable<ReadOnlySpan<char>>

Constructors

JsonPathSegment

JsonPathSegment(string name)

JsonPathSegment(ReadOnlyMemory<char> name)

JsonPathSegment(int index)

JsonPathSegment(Index index)

Methods

Create

static JsonPathSegment Create(string name)

static JsonPathSegment Create(ReadOnlyMemory<char> name)

static JsonPathSegment Create(int index)

static JsonPathSegment Create(Index index)

Equals

bool Equals(object obj)

bool Equals(JsonPathSegment other)

bool Equals(string key)

bool Equals(ReadOnlyMemory<char> key)

bool Equals(ReadOnlySpan<char> key)

bool Equals(int index)

bool Equals(Index index)

GetHashCode

int GetHashCode()

IsEmpty

bool IsEmpty()

Tests if this path segment is empty (ie: no path)

IsIndex

bool IsIndex()

Tests if this path is for an array item

If true, this segment contains a valid item

IsName

bool IsName()

Tests if this path is for an object field

If true, this segment contains a valid field

ToString

string ToString()

string ToString(string format, IFormatProvider provider = null)

TryFormat

bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider)

TryGetIndex

bool TryGetIndex(out Index index)

If this is a path to an array item, return the index of the item

  • index — Receives the index of the item

Returns: true if this segments points to an array item; otherwise, false

TryGetName

bool TryGetName(out ReadOnlyMemory<char> name)

If this is a path to a field, return the name of the field

  • name — Receives the name of the field

Returns: true if this segments points to a field; otherwise, false

Fields

Empty

static readonly JsonPathSegment Empty

Index

readonly Index? Index

Name

readonly ReadOnlyMemory<char> Name