Table of Contents

Interface IModelNodeAccessor

Namespace
MRX.Json.Reflection.Abstractions
Assembly
MRX.Json.Reflection.dll

Resolves a single JSON path token against a model instance, reading the value it refers to.

public interface IModelNodeAccessor

Methods

CanHandle(JsonPathTokenType, string, object)

Determines whether this accessor is able to resolve token against container.

bool CanHandle(JsonPathTokenType tokenType, string token, object container)

Parameters

tokenType JsonPathTokenType

The kind of path token being resolved (property, array index, etc.).

token string

The raw token text extracted from the JSON path.

container object

The object instance the token should be resolved against.

Returns

bool

true if this accessor can handle the token; otherwise, false.

GetValue(string, object)

Resolves the value referred to by token on container.

object? GetValue(string token, object container)

Parameters

token string

The raw token text extracted from the JSON path.

container object

The object instance to read the value from.

Returns

object

The resolved value, or null if the token does not refer to a value.