Table of Contents

Class RuleJsonValue

Namespace
RuleWright.Serialization
Assembly
RuleWright.Serialization.dll

A minimal, immutable, library-neutral JSON value tree. JSON reader adapters (System.Text.Json, Newtonsoft.Json, …) translate their own DOM into this type, which keeps RuleWright.Serialization free of any JSON library dependency.

public sealed class RuleJsonValue
Inheritance
RuleJsonValue
Inherited Members

Properties

False

The shared JSON false node.

Items

Array items in document order; empty for non-arrays.

Kind

The node's kind.

Null

The shared JSON null node.

Properties

Object properties in document order; empty for non-objects.

True

The shared JSON true node.

Methods

CreateArray(IEnumerable<RuleJsonValue>)

Creates an array node.

CreateBoolean(bool)

Creates a boolean node.

CreateNumber(decimal)

Creates a number node from a decimal.

CreateNumber(double)

Creates a number node from a double.

CreateNumber(long)

Creates a number node from an integer.

CreateNumber(string)

Creates a number node from its raw JSON text (invariant culture).

CreateObject(IEnumerable<KeyValuePair<string, RuleJsonValue>>)

Creates an object node.

CreateString(string)

Creates a string node.

GetRawNumber()

The raw invariant-culture number text of a Number node.

GetString()

The string value of a String node.

ToClrValue()

Converts a scalar node to its CLR value: string, bool, null, or a number as long when integral, otherwise decimal when exactly representable, otherwise double.

TryGetInt64(out long)

Whether this number node holds an integral value representable as long.

TryGetProperty(string, out RuleJsonValue)

Looks up an object property by exact (ordinal) name.