Jsonb

Namespace: SnowBank.Data.Json.Binary · class

Compact binary JSON encoder that supports partial decoding of documents

Remarks

Generates a binary payload intended for cases where only part of large documents would be decoded (for indexing, filtering, ...)

It is optimized for "random traversal" from the root to specific fields, without having to decode the entire document.

All items have a size prefix as well as an optional offset table that quickly allows jumping to the desired location.

For cases where the document is small, or will always need to be decoded completely, please consider using JsonPack instead.

Methods

CreateSelector

static JLookupSelector CreateSelector(string path)

Creates a selector for the value at the specified path

static JLookupSelector CreateSelector(ReadOnlyMemory<char> path)

Creates a selector for the value at the specified path

static JLookupSelector CreateSelector(JsonPath path)

Creates a selector for the value at the specified path

Decode

static JsonValue Decode(Slice data, StringTable table = null)

Decodes a jsonb binary blob into the corresponding JsonValue

static JsonValue Decode(ReadOnlySpan<byte> data, StringTable table = null)

Decodes a jsonb binary blob into the corresponding JsonValue

Encode

static Slice Encode(JsonValue value, JsonbWriterOptions options = null)

Encodes a JsonValue into a jsonb binary blob

static Slice Encode(JsonValue value, ref byte[] buffer, JsonbWriterOptions options = null)

Encodes a JsonValue into a jsonb binary blob

EncodeTo

static Slice EncodeTo(ref SliceWriter output, JsonValue value)

Encodes a JsonValue into a jsonb binary blob

Get

static TValue Get<TValue>(Slice buffer, string path, TValue missing = null)

Decodes the value of a specific field in a jsonb binary blob, without decoding the entire document

static TValue Get<TValue>(Slice buffer, ReadOnlyMemory<char> path, TValue missing = null)

Decodes the value of a specific field in a jsonb binary blob, without decoding the entire document

static TValue Get<TValue>(Slice buffer, JsonPath path, TValue missing = null)

Decodes the value of a specific field in a jsonb binary blob, without decoding the entire document

static TValue Get<TValue>(Slice buffer, JLookupSelector selector, TValue missing = null)

Decodes the value of a specific field in a jsonb binary blob, without decoding the entire document

static TValue Get<TValue>(ReadOnlySpan<byte> buffer, string path, TValue missing = null)

Decodes the value of a specific field in a jsonb binary blob, without decoding the entire document

static TValue Get<TValue>(ReadOnlySpan<byte> buffer, ReadOnlyMemory<char> path, TValue missing = null)

Decodes the value of a specific field in a jsonb binary blob, without decoding the entire document

static TValue Get<TValue>(ReadOnlySpan<byte> buffer, JsonPath path, TValue missing = null)

Decodes the value of a specific field in a jsonb binary blob, without decoding the entire document

static TValue Get<TValue>(ReadOnlySpan<byte> buffer, JLookupSelector selector, TValue missing = null)

Decodes the value of a specific field in a jsonb binary blob, without decoding the entire document

Select

static JsonValue Select(Slice buffer, string path, StringTable table = null)

Reads a specific field in a jsonb binary blob, without decoding the entire document

static JsonValue Select(Slice buffer, ReadOnlyMemory<char> path, StringTable table = null)

Reads a specific field in a jsonb binary blob, without decoding the entire document

static JsonValue Select(Slice buffer, JsonPath path, StringTable table = null)

Reads a specific field in a jsonb binary blob, without decoding the entire document

static JsonValue Select(Slice buffer, JLookupSelector selector, StringTable table = null)

Reads a specific field in a jsonb binary blob, without decoding the entire document

static JsonValue Select(ReadOnlySpan<byte> buffer, string path, StringTable table = null)

Reads a specific field in a jsonb binary blob, without decoding the entire document

static JsonValue Select(ReadOnlySpan<byte> buffer, ReadOnlyMemory<char> path, StringTable table = null)

Reads a specific field in a jsonb binary blob, without decoding the entire document

static JsonValue Select(ReadOnlySpan<byte> buffer, JsonPath path, StringTable table = null)

Reads a specific field in a jsonb binary blob, without decoding the entire document

static JsonValue Select(ReadOnlySpan<byte> buffer, JLookupSelector selector, StringTable table = null)

Reads a specific field in a jsonb binary blob, without decoding the entire document

Test

static bool Test<TValue>(Slice buffer, string path, TValue value)

Tests if a specific field in a jsonb binary blob is equal to the expected value, without decoding the entire document

static bool Test<TValue>(Slice buffer, ReadOnlyMemory<char> path, TValue value)

Tests if a specific field in a jsonb binary blob is equal to the expected value, without decoding the entire document

static bool Test<TValue>(Slice buffer, JsonPath path, TValue value)

Tests if a specific field in a jsonb binary blob is equal to the expected value, without decoding the entire document

static bool Test<TValue>(Slice buffer, JLookupSelector selector, TValue value)

Tests if a specific field in a jsonb binary blob is equal to the expected value, without decoding the entire document

static bool Test<TValue>(ReadOnlySpan<byte> buffer, string path, TValue value)

Tests if a specific field in a jsonb binary blob is equal to the expected value, without decoding the entire document

static bool Test<TValue>(ReadOnlySpan<byte> buffer, ReadOnlyMemory<char> path, TValue value)

Tests if a specific field in a jsonb binary blob is equal to the expected value, without decoding the entire document

static bool Test<TValue>(ReadOnlySpan<byte> buffer, JsonPath path, TValue value)

Tests if a specific field in a jsonb binary blob is equal to the expected value, without decoding the entire document

static bool Test<TValue>(ReadOnlySpan<byte> buffer, JLookupSelector selector, TValue value)

Tests if a specific field in a jsonb binary blob is equal to the expected value, without decoding the entire document

Warmup

static void Warmup()