&gt; typecasting the JSON i got<p>This is where a typed serialization comes in handy. (Protobufs, Thrift, Cap&#x27;n Proto, etc.) It is also possible to use an IDL to generate a type-safe API to deal with JSON -- although I don&#x27;t know of any tools that emit Swift. Interfacing with third-party JSON APIs can be a pain though.