C# Class SteamWebAPI2.Utilities.JsonConverters.AssetClassInfoJsonConverter

Handles manual deserialization of the response from ISteamEconomy/GetAssetClassInfo. I could not rely on automatic deserialization with property attribute decorators because the JSON structure of the response is completely awful. Instead of using JSON arrays, the JSON response contains multiple dynamically build objects with varying numbers of properties whose values correspond to what appear to be arrays indices. The response appears to be a conversion from Valve Data Format (VDF) to JSON. So to clean this up, I manually deserialize into objects that aren't awful. Example of the bad JSON response: "descriptions": { "0": { "type": "text", "value": "Paint Color: Color No. 216-190-216", "color": "756b5e", "app_data": "" }, "1": { "type": "text", "value": "You wouldn't mind if I read this top secret document with my beard, would you?", "app_data": "" } } You can see in the above that the properties "0" and "1" seem to be array indices. Each AssetClassInfo in the response can have a varying number of these properties. So I fixed that by deserializing into sane arrays.
Inheritance: Newtonsoft.Json.JsonConverter
Afficher le fichier Open project: babelshift/SteamWebAPI2

Méthodes publiques

Méthode Description
CanConvert ( Type objectType ) : bool
ReadJson ( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer ) : object
WriteJson ( JsonWriter writer, object value, JsonSerializer serializer ) : void

Method Details

CanConvert() public méthode

public CanConvert ( Type objectType ) : bool
objectType System.Type
Résultat bool

ReadJson() public méthode

public ReadJson ( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer ) : object
reader Newtonsoft.Json.JsonReader
objectType System.Type
existingValue object
serializer Newtonsoft.Json.JsonSerializer
Résultat object

WriteJson() public méthode

public WriteJson ( JsonWriter writer, object value, JsonSerializer serializer ) : void
writer Newtonsoft.Json.JsonWriter
value object
serializer Newtonsoft.Json.JsonSerializer
Résultat void