mirror of
https://github.com/LukeHagar/plexswift.git
synced 2025-12-06 12:47:44 +00:00
18 lines
514 B
Swift
18 lines
514 B
Swift
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
|
|
import Foundation
|
|
|
|
func jsonEncoder() -> JSONEncoder {
|
|
let jsonEncoder = JSONEncoder()
|
|
// Sort keys to make this easier to test resulting JSON.
|
|
jsonEncoder.outputFormatting = [.sortedKeys]
|
|
return jsonEncoder
|
|
}
|
|
|
|
func serializeEncodable(_ encodable: Encodable?) throws -> String? {
|
|
guard let encodable else { return nil }
|
|
|
|
let data = try jsonEncoder().encode(encodable)
|
|
return String(data: data, encoding: .utf8)
|
|
}
|