問題タブ [serde-json]
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.
rust - JSON 文字列または文字列の配列を Vec に逆シリアル化します
JSON Web API と連携するクレートを作成しています。1 つのエンドポイントは通常、フォームの応答を返します{ "key": ["value1", "value2"] }
が、キーの値が 1 つしかなく、エンドポイントが{ "key": "value" }
代わりに返す場合があります。{ "key": ["value"] }
#[serde(deserialize_with)]
次のように使用できる一般的なものを書きたかったのです。
これを行うにはどうすればaを書くことdeserialize_string_or_seq_string
ができますか?