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.JsonAPI, 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
Low-level JSON custom serializations for SDK types.
The JSON converter for AttributeRef.
The JSON converter for Context.
The JSON converter for EvaluationErrorKind.
The JSON converter for EvaluationReasonKind.
The JSON converter for LdValue.
The JSON converter for UnixMillisecondTime.
The JSON converter for User.
Helper methods for JSON serialization of SDK classes.
A marker interface for types that define their own JSON serialization rules.