Table of Contents

Json

The framework extends JSON handling with helper methods and serializer support for common runtime types.

Features

  • object.Json(): serialize to a JSON string
  • string.Json<T>(): deserialize a JSON payload into a known type
  • string.JsonFind<T>(): navigate a nested payload and extract a specific value by path
  • Attribute-based transformations: encryption, obfuscation, and compression can be applied transparently during serialization

Behavior

The framework includes converter support for common values such as string, int, long, DateTime, DateTimeOffset, Guid, Uri, and enums. Non-serializable types such as Exception, Thread, and Stream are skipped rather than crashing the serializer.

var json = myObject.Json();
var model = json.Json<MyType>();

JsonFind<T>() is especially useful when consuming larger third-party payloads and you need only a small subset of the data.

Caveats

  • JsonFind<T>() throws when the selected path does not exist.
  • dynamic payloads bypass some of the framework’s converter behavior, so values may come back as raw strings.
  • JsonSerializerOptions are rebuilt per call, which preserves thread safety without relying on a shared static serializer instance.
Tip

Use JsonFind<T>() when you need a single value from a larger document without deserializing the full payload tree.