サービスから受信した JSON 応答のマッピング オブジェクト/応答モデルを作成できません。
カスタム JsonConverter を作成しようとしましたが、デシリアライズの問題を解決するのに役立つ適切な方法が見つかりませんでした
以下は、サービスから取得している JSON 応答です。
{
"$base": "Collection",
"nodeType": "PROTOCOL",
"Smart Building 0": {
"$base": "Collection",
"nodeType": "NETWORK",
"truncated": "true"
},
"Smart Building 1": {
"$base": "Collection",
"nodeType": "NETWORK",
"truncated": "true"
},
"Smart Building 2": {
"$base": "Collection",
"nodeType": "NETWORK",
"truncated": "true"
}
}
例 1:- 同じサービスが以下の JSON 形式を返すことができます
{
"$base": "Collection",
"nodeType": "PROTOCOL",
"Smart Building 0": {
"$base": "Collection",
"nodeType": "NETWORK",
"truncated": "true"
},
"Smart Building 1": {
"$base": "Collection",
"nodeType": "NETWORK",
"truncated": "true"
}
}
JsonConvert を使用したデシリアライズに簡単に使用できるように、C# ルート オブジェクト クラスを作成します。