問題タブ [codable]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
1400 問題
0
投票する
1
に答える
523
参照
json - 空の文字列または int のいずれかになるコーディング可能な JSON フィールドをどのように設計しますか?
空の文字列または int のいずれかになる可能性がある JSON からのコード化可能な構造体のフィールドをどのように処理しますか? データ型 any を使用してみましたが、それは codable に準拠していません。値がない場合は空の文字列を返すか、そうでない場合はintを返すと思います。Swift 4 と XCode 9 を使用しています。よろしくお願いします