Skip to content

Commit

Permalink
Merge pull request #53 from AssemblyAI/niels/remove-json-extensions
Browse files Browse the repository at this point in the history
Remove JSON extension, make JsonUtils public
  • Loading branch information
Swimburger authored Sep 9, 2024
2 parents e5ca7e1 + f04ec18 commit 270d78e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/AssemblyAI/Core/JsonConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ static JsonOptions()
/// <summary>
/// Utilities class for JSON serialization and deserialization.
/// </summary>
internal static class JsonUtils
public static class JsonUtils
{
/// <summary>
/// Serialize an object to JSON using the AssemblyAI SDKs JSON options.
/// </summary>
/// <param name="obj">Object to serialize</param>
/// <typeparam name="T">Type of the object to serialize</typeparam>
/// <returns>The object serialized as JSON</returns>
internal static string Serialize<T>(T obj)
public static string Serialize<T>(T obj)
=> JsonSerializer.Serialize(obj, JsonOptions.JsonSerializerOptions);

/// <summary>
Expand All @@ -51,7 +51,7 @@ internal static string Serialize<T>(T obj)
/// <param name="obj">Object to serialize</param>
/// <typeparam name="T">Type of the object to serialize</typeparam>
/// <returns>The object serialized as JSON</returns>
internal static JsonDocument SerializeToDocument<T>(T obj)
public static JsonDocument SerializeToDocument<T>(T obj)
=> JsonSerializer.SerializeToDocument(obj, JsonOptions.JsonSerializerOptions);

/// <summary>
Expand All @@ -60,7 +60,7 @@ internal static JsonDocument SerializeToDocument<T>(T obj)
/// <param name="obj">Object to serialize</param>
/// <typeparam name="T">Type of the object to serialize</typeparam>
/// <returns>The object serialized as JSON</returns>
internal static JsonElement SerializeToElement<T>(T obj)
public static JsonElement SerializeToElement<T>(T obj)
=> JsonSerializer.SerializeToElement(obj, JsonOptions.JsonSerializerOptions);

/// <summary>
Expand All @@ -69,7 +69,7 @@ internal static JsonElement SerializeToElement<T>(T obj)
/// <param name="obj">Object to serialize</param>
/// <typeparam name="T">Type of the object to serialize</typeparam>
/// <returns>The object serialized as JSON</returns>
internal static JsonNode? SerializeToNode<T>(T obj)
public static JsonNode? SerializeToNode<T>(T obj)
=> JsonSerializer.SerializeToNode(obj, JsonOptions.JsonSerializerOptions);

/// <summary>
Expand All @@ -78,7 +78,7 @@ internal static JsonElement SerializeToElement<T>(T obj)
/// <param name="json">The JSON string</param>
/// <typeparam name="T">The type to deserialize the JSON to</typeparam>
/// <returns>The deserialized object of type T</returns>
internal static T Deserialize<T>(string json)
public static T Deserialize<T>(string json)
=> JsonSerializer.Deserialize<T>(json, JsonOptions.JsonSerializerOptions)!;

/// <summary>
Expand All @@ -87,7 +87,7 @@ internal static T Deserialize<T>(string json)
/// <param name="json">The JSON string</param>
/// <typeparam name="T">The type to deserialize the JSON to</typeparam>
/// <returns>The deserialized object of type T</returns>
internal static T Deserialize<T>(JsonDocument json)
public static T Deserialize<T>(JsonDocument json)
=> json.Deserialize<T>(JsonOptions.JsonSerializerOptions)!;

/// <summary>
Expand All @@ -96,7 +96,7 @@ internal static T Deserialize<T>(JsonDocument json)
/// <param name="json">The JSON string</param>
/// <typeparam name="T">The type to deserialize the JSON to</typeparam>
/// <returns>The deserialized object of type T</returns>
internal static T Deserialize<T>(JsonElement json)
public static T Deserialize<T>(JsonElement json)
=> json.Deserialize<T>(JsonOptions.JsonSerializerOptions)!;

/// <summary>
Expand All @@ -105,6 +105,6 @@ internal static T Deserialize<T>(JsonElement json)
/// <param name="json">The JSON string</param>
/// <typeparam name="T">The type to deserialize the JSON to</typeparam>
/// <returns>The deserialized object of type T</returns>
internal static T Deserialize<T>(JsonNode json)
public static T Deserialize<T>(JsonNode json)
=> json.Deserialize<T>(JsonOptions.JsonSerializerOptions)!;
}

0 comments on commit 270d78e

Please sign in to comment.