20 lines
529 B
Swift
Raw Normal View History

2024-12-10 16:33:57 +00:00
import Foundation
extension JSONEncoder {
static let devRant: JSONEncoder = {
let encoder = JSONEncoder()
encoder.dateEncodingStrategy = .iso8601
encoder.keyEncodingStrategy = .convertToSnakeCase
return encoder
}()
}
extension JSONDecoder {
static let devRant: JSONDecoder = {
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .iso8601WithOptionalFractionalSeconds
decoder.keyDecodingStrategy = .convertFromSnakeCase
return decoder
}()
}