Show / Hide Table of Contents

Namespace LaunchDarkly.Sdk.Json

Helper classes and methods for interoperability with JSON.

The NuGet package containing these types is LaunchDarkly.CommonSdk. Normally you should not need to reference that package directly; it is loaded automatically as a dependency of the main SDK package.

Any LaunchDarkly SDK type that has the marker interface IJsonSerializable has a canonical JSON encoding that is consistent across all LaunchDarkly SDKs. There are three ways to convert any such type to or from JSON:

  • When using the System.Text.Json API, these types already have the necessary attributes to behave correctly.
  • You may use the LdJsonSerialization methods SerializeObject<T>(T) and DeserializeObject<T>(String) to convert to or from a JSON-encoded string.

Earlier versions of the LaunchDarkly SDKs used Newtonsoft.Json for JSON serialization, but current versions have no such third-party dependency. Therefore, these types will not work correctly with the reflection-based JsonConvert methods in Newtonsoft.Json without some extra logic. There is an add-on package, LaunchDarkly.CommonSdk.JsonNet, that provides an adapter to make this work; alternatively, you can call SerializeObject<T>(T) and put the resulting JSON output into a Newtonsoft.Json.Linq.JRaw value.

Classes

LdJsonConverters

Low-level JSON custom serializations for SDK types.

LdJsonConverters.AttributeRefConverter

The JSON converter for AttributeRef.

LdJsonConverters.BigSegmentsStatusConverter

LdJsonConverters.ContextConverter

The JSON converter for Context.

LdJsonConverters.EvaluationErrorKindConverter

The JSON converter for EvaluationErrorKind.

LdJsonConverters.EvaluationReasonConverter

LdJsonConverters.EvaluationReasonKindConverter

The JSON converter for EvaluationReasonKind.

LdJsonConverters.LdValueConverter

The JSON converter for LdValue.

LdJsonConverters.UnixMillisecondTimeConverter

The JSON converter for UnixMillisecondTime.

LdJsonConverters.UserConverter

The JSON converter for User.

LdJsonSerialization

Helper methods for JSON serialization of SDK classes.

Interfaces

IJsonSerializable

A marker interface for types that define their own JSON serialization rules.

In This Article
Back to top Generated by DocFX