// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.JSInterop { /// /// Provides mechanisms for converting between .NET objects and JSON strings for use /// when making calls to JavaScript functions via . /// /// Warning: This is not intended as a general-purpose JSON library. It is only intended /// for use when making calls via . Eventually its implementation /// will be replaced by something more general-purpose. /// public static class Json { /// /// Serializes the value as a JSON string. /// /// The value to serialize. /// The JSON string. public static string Serialize(object value) => SimpleJson.SimpleJson.SerializeObject(value); internal static string Serialize(object value, SimpleJson.IJsonSerializerStrategy serializerStrategy) => SimpleJson.SimpleJson.SerializeObject(value, serializerStrategy); /// /// Deserializes the JSON string, creating an object of the specified generic type. /// /// The type of object to create. /// The JSON string. /// An object of the specified type. public static T Deserialize(string json) => SimpleJson.SimpleJson.DeserializeObject(json); internal static T Deserialize(string json, SimpleJson.IJsonSerializerStrategy serializerStrategy) => SimpleJson.SimpleJson.DeserializeObject(json, serializerStrategy); } }