I need to convert all keys and their values of a class in lowercase. For example,
class Person : Encodable {
    var firstName: String
    var lastName: String
     var city: String
}
 var person = Person(firstName: "David", lastName: "Gill", city: 
 "Toronto")
 let encoder = JSONEncoder()
 encoder.keyEncodingStrategy = .convertToLowerCase
 let encoded = try encoder.encode(person)
 print(String(decoding: encoded, as: UTF8.self))
Where convertToLowerCase is a method I have added in extension of JSONEncoder.KeyEncodingStrategy to convert keys into lowercase.
It prints - {"city":"Toronto","firstname":"David","lastname":"Gill"}
What I need to print is - {"city":"toronto","firstname":"david","lastname":"gill"}
Can someone please help here?
 
     
     
     
    