What errors can happen when encode with Swift JSONEncoder

Viewed 1567

JSONEncoder method func encode<T>(_ value: T) throws -> Data where T : Encodable is throwable.

I wonder why is it throwable: If the value to encode is not conform to Encodable, it can't pass compiler checking, so it should encounter no errors at runtime.

1 Answers
Related