You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The original Dictionary accepts such a format, but the OrderedDictionary expects the array of the key-value pairs which is a serious limitation in decoding.
Expected behavior
The OrderedDictionary should be decoded as a regular Dictionary.
Actual behavior
Expected to decode Array but found a dictionary instead.
The text was updated successfully, but these errors were encountered:
OrderedDictionary needs to guarantee that the order of its items will not change during serialization/deserialization. This is not guaranteed by Codable's keyed containers -- therefore they aren't suitable for use by OrderedDictionary.
Note that Codable is a common denominator archival solution, primarily intended for use where you don't care about the precise details of the serialized format. It is the Swift version of NSCoding, or Python's pickle. Codable is emphatically not a flexible JSON encoder/decoder that's designed to interoperate with arbitrary JSON APIs.
Information
Checklist
mainbranch of this package.Steps to Reproduce
Try to decode an OrderedDictionary from this JSON:
The original Dictionary accepts such a format, but the OrderedDictionary expects the array of the key-value pairs which is a serious limitation in decoding.
Expected behavior
The OrderedDictionary should be decoded as a regular Dictionary.
Actual behavior
Expected to decode Array but found a dictionary instead.
The text was updated successfully, but these errors were encountered: