Our great sponsors
-
scout
Reading and writing in JSON, Plist, YAML and XML data made simple when the data format is not known at build time. Swift library and command-line tool. (by ABridoux)
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
Check out quicktype.io. You can paste in your JSON and it will build your model for you. There's even an option for creating constructors. And you can choose your programming language. I usually spend some time cleaning it up a bit. It's not the perfect solution and I don't use it all the time, but it sure saves time for complicated models.
I developed a library that is better suited for such cases than plain Decodable. You can specify a path in the data and at the end of the path specify a Decodable type to be instantiated from the data.