@@ -251,6 +251,13 @@ public class JsonConfig {
251251 }
252252 return encoder
253253 }
254+
255+ public static var keywords = [
256+ " class " , " deinit " , " description " , " enum " , " extension " , " func " , " import " , " init " , " let " , " protocol " , " static " ,
257+ " struct " , " subscript " , " typealias " , " associatedtype " , " var " , " break " , " case " , " continue " , " default " , " do " ,
258+ " else " , " fallthrough " , " if " , " in " , " for " , " return " , " switch " , " where " , " while " , " dynamicType " , " is " , " new " ,
259+ " super " , " self " , " didSet " , " get " , " infix " , " inout " , " left " , " mutating " , " none " , " nonmutating " , " operator " ,
260+ " override " , " postfix " , " precedence " , " prefix " , " right " , " set " , " unowned " , " weak " , " willSet " ]
254261
255262 public static func createDecoder( ) -> JSONDecoder {
256263 let decoder = JSONDecoder ( )
@@ -262,10 +269,13 @@ public class JsonConfig {
262269 }
263270 //remove _ prefix from @propertyWrapper properties
264271 let keyString = lastKey. stringValue
265- // print(keyString)
266272 if keyString. starts ( with: " _ " ) {
267273 return AnyKey ( stringValue: String ( keyString. dropFirst ( ) ) ) ?? lastKey
268274 }
275+ if keywords. contains ( keyString) {
276+ let useKey = keyString. prefix ( 1 ) . uppercased ( ) + keyString. dropFirst ( )
277+ return AnyKey ( stringValue: useKey) ?? lastKey
278+ }
269279 return lastKey
270280 }
271281 decoder. dateDecodingStrategy = . custom( { ( decoder) -> Date in
0 commit comments