Dynamic Classes and Variables

I need to dynamically convert Json response to Codable class and vice versa. Any help or Suggestions would be appreciated.

Detailed requirement posted here

Thank you

If certain fields in the JSON payload may or may not be present, then just make them optional in the swift struct. Why can't you just do that?

hi @Peter-Schorn , We don't know/predict what fields may add or delete at backend side. On fly we have to create our models, so that i am trying dynamic way. Any help?

Try JSONSerialization from the Foundation.

Or try SwiftyJSON.

1 Like
Terms of Service

Privacy Policy

Cookie Policy