わかりましたので、以前は JSON.NET で行き詰まっていましたが、再び立ち往生しています。最後の質問のおかげで、皆さんが私を助けてくれて、プロジェクトを正常に完了しました:3. ただし、実際にはキーを持たない JSON を逆シリアル化する必要があります。それはできますが、整数であり、0 から 50 の間で変化する可能性があるため、これを行う方法がわかりません。私は IDictionary を使用しようとしましたが、それは惨めに失敗しました... とにかく、JSON は次のとおりです。
{
"response": {
"success": 1,
"current_time": 1362339098, // this will return the time when cache was generated
"prices": {
"35": { // defindex
"11": { // quality
"0": { // price index ( crate # or unusual effect, 0 when not used )
"current": { // current price
"currency": "keys",
"value": 39,
"value_high": 41,
"date": 1357515306 // date when the price was updated
},
"previous": { // previous price
"currency": "keys",
"value": 37,
"value_high": 39
}
}
},
"3": { // quality
"0": { // price index
"current": {
"currency": "metal",
"value": 0.33,
"value_high": 0.66
}
}
}
},
"5002": { // refined metal, useful for converting usd prices into metal
"6": {
"0": {
"current": {
"currency": "usd",
"value": 0.39,
"value_high": 0.42,
"date": 1358090106
}
}
}
},
"5022": { // one of the crate defindex
"6": {
"1": { // crate #1
"current": {
"currency": "metal",
"value": 1.33,
"value_high": 1.55,
"date": 1357515175
}
}
}
}
}
}
}
(Dat の書式設定... もう一度...)
そして、私の哀れな試みをここに示します:
public class Json1 {
public Json2 response { get; set; }
}
public class Json2 {
public int success { get; set; }
public string current_time { get; set; }
public IDictionary<int, Json3> prices { get; set; }
}
public class Json3 {
}
public class Json4 {
}
public class Json5 {
public Json6 current { get; set; }
}
public class Json6 {
public string currency { get; set; }
public string value { get; set; }
public string value_high { get; set; }
}
Json 3と4は、削除して別のことを試しているため、空です...
しかし、ええ... jsonに慣れてきましたが、これを理解できません。フレンドリーな回答は、事前に大歓迎です。
(いくつかの float と long で文字列を使用したことは知っていますが、これは意図的なものでしたが、変更できると思います)