C# 클래스 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.
상속: Newtonsoft.Json.JsonConverter
파일 보기 프로젝트 열기: babelshift/SteamWebAPI2

공개 메소드들

메소드 설명
CanConvert ( Type objectType ) : bool
ReadJson ( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer ) : object
WriteJson ( JsonWriter writer, object value, JsonSerializer serializer ) : void

메소드 상세

CanConvert() 공개 메소드

public CanConvert ( Type objectType ) : bool
objectType System.Type
리턴 bool

ReadJson() 공개 메소드

public ReadJson ( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer ) : object
reader Newtonsoft.Json.JsonReader
objectType System.Type
existingValue object
serializer Newtonsoft.Json.JsonSerializer
리턴 object

WriteJson() 공개 메소드

public WriteJson ( JsonWriter writer, object value, JsonSerializer serializer ) : void
writer Newtonsoft.Json.JsonWriter
value object
serializer Newtonsoft.Json.JsonSerializer
리턴 void