マルチレベルの JSON 配列からオブジェクトを取得しようとしています。これはテーブルの例です: array(2) {
["asd"]=>
array(3) {
["id"]=>
int(777)
["profile"]=>
array(4) {
["username"]=>
string(5) "grega"
["email"]=>
string(18) "random@example.com"
["image"]=>
string(16) "http...image.jpg"
["age"]=>
int(26)
}
["name"]=>
string(5) "Grega"
}
["be"]=>
array(4) {
["username"]=>
string(5) "grega"
["email"]=>
string(18) "random@example.com"
["image"]=>
string(16) "http...image.jpg"
["age"]=>
int(26)
}
}
私が到達しようとしている文字列は、電子メールのいずれかです (例)。これは私がそれを試す方法です:
public class getAsd
{
public string asd;
}
public class Profile
{
public string username { get; set; }
public string email { get; set; }
public string image { get; set; }
public string age { get; set; }
}
}
そして、それを逆シリアル化するために使用JavaScriptSerilization.Deserilize<Asd>(jsonData);
しますが、「プロファイル」で同じことを試みると、次のエラーが表示されます。
No parameterless constructor defined for type of 'System.String'.
JSON:
{"asd":{"id":777,"profile":{"username":"grega","email":"random@example.com","image":"http...image.jpg","age":26},"name":"Grega"},"be":{"username":"grega","email":"random@example.com","image":"http...image.jpg","age":26}}
そして、何が間違っているのでしょうか?