私はそれに与えられた情報(検索サービス)に応じて、文字列要素または文字列要素のリストを持つ要素を返すRESTサービスを扱っています。たとえば、0個以上のイメージを持つアイテムを検索して、URL文字列として保存することができます。私model
は、私の例に対処するには、次のプロパティが含まれていますWP7でDataContractJsonSerializerはどのように動作しますか?
private List<string> _Images = new List<string>();
[DataMember(Name="images", IsRequired=false)]
public List<string> Images
{
get
{
return _Images;
}
set
{
_Images = value;
onPropertyChanged("Images");
}
}
サンプルJSON
いくつかの画像で:
{
"id": 24955,
"title": "Conan the Barbarian",
"duration": 105,
"hd": false,
"trailer": "800/BM_6305_800_tr.wmv",
"images": [
"http://website.com/images/conanthebar_1.jpg",
"http://website.com/images/conanthebar_2.jpg",
"http://website.com/images/conanthebar_3.jpg",
"http://website.com/images/conanthebar_4.jpg",
"http://website.com/images/conanthebar_5.jpg",
"http://website.com/images/conanthebar_6.jpg"
]
}
サンプルJSON
ONEイメージを持つ:
{
"id": 24955,
"title": "Conan the Barbarian",
"duration": 105,
"hd": false,
"trailer": "800/BM_6305_800_tr.wmv",
"images": "http://website.com/images/conanthebar_6.jpg"
}
、私の質問は、私はDataContractJsonSerializer
を使用しているとき、どのようにこれが処理されますか?私の入って来るjsonのイメージ文字列が(文字列の配列/リストと比較して)単一の文字列である場合、それは1つのメンバだけで文字列のリストに変換されますか?そうでない場合
最後に、(私の理論はfalse)、どのような状況を扱うことができますか。
質問を説明するJSONの例がありますか? –