CodableWrappers icon indicating copy to clipboard operation
CodableWrappers copied to clipboard

Feature request: change name of key

Open jimbengtsson92 opened this issue 2 years ago • 1 comments

I would like to have a property wrapper that made it possible to change name of the key used when encoding and decoding. The result could look like this:

struct MyStruct: Codable {
   @CustomKey("key_in_json") var myOwnName: String
}

It is possible that I can do this by creating a custom codable wrapper, but so far I have not been able to achieve it. The backed codable package has support for this. I think it would be really nice if this package could include this as well :)

jimbengtsson92 avatar Jan 20 '23 09:01 jimbengtsson92

This is now possible (in beta) with Macros! here's the tag with the initial release: https://github.com/GottaGetSwifty/CodableWrappers/releases/tag/3.0.0-alpha-release-1

GottaGetSwifty avatar Sep 13 '23 16:09 GottaGetSwifty

3.0 is now released! https://github.com/GottaGetSwifty/CodableWrappers/releases/tag/3.0.0

Thank you for your patience

GottaGetSwifty avatar Apr 27 '24 17:04 GottaGetSwifty