LaunchDarkly Dotnet Server SDK
Search Results for

    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.

    • Edit this page
    In this article
    Back to top Generated by DocFX