Created
June 24, 2015 09:19
-
-
Save px-amaac/ddef80f8d10459b7fd02 to your computer and use it in GitHub Desktop.
deserializer for dealing with lines 18-24 and 45-46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JsonDeserializer<T> implements com.google.gson.JsonDeserializer<T> { | |
@Override | |
public T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | |
Type genericClass = ((ParameterizedType) typeOfT).getActualTypeArguments()[0]; | |
if(genericClass != Boolean.class) { | |
if (json.isJsonPrimitive()) { | |
JsonPrimitive jsonPrimitive = json.getAsJsonPrimitive(); | |
if(jsonPrimitive.isBoolean()) { | |
return null; | |
} | |
} | |
} | |
return context.deserialize(json, typeOfT); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Airtime": { | |
"start": "18:30:00", | |
"end": "19:30:00", | |
"start_x": "18:30:00", | |
"end_x": "19:30:00", | |
"start_f": "18:30:00", | |
"end_f": "19:30:00", | |
"start_gmt": "01:30:00", | |
"end_gmt": "02:30:00", | |
"weekday": "1" | |
}, | |
"id": "150", | |
"title": "Le Show", | |
"short_name": "leshow", | |
"full_description": "<p>From Firesign Theater to Spin Tap, from Saturday Night Live to the Simpsons, Harry Shearer's done it all. Now hear the world through a new prizm, Le Show with Harry Shearer.<\/p><p>Le Show airs Monday evenings at 6:30pm following Moyer's & Co. <\/p>", | |
"short_description": "A satirical romp through the week's news with the incomparable Harry Shearer ", | |
"Image": { | |
"url": "https:\/\/s3.amazonaws.com\/image\/original\/le_show_logo.jpg", | |
"url_sm": "https:\/\/s3.amazonaws.com\/image\/small\/le_show_logo.jpg", | |
"url_md": "https:\/\/s3.amazonaws.com\/image\/medium\/le_show_logo.jpg", | |
"url_lg": "https:\/\/s3.amazonaws.com\/image\/large\/le_show_logo.jpg" | |
}, | |
"image": "le_show_logo.jpg", | |
"hosts": [], | |
"categories": [] | |
}, | |
{ | |
"Airtime": { | |
"start": "19:30:00", | |
"end": "22:00:00", | |
"start_x": "19:30:00", | |
"end_x": "22:00:00", | |
"start_f": "19:30:00", | |
"end_f": "22:00:00", | |
"start_gmt": "02:30:00", | |
"end_gmt": "05:00:00", | |
"weekday": "1" | |
}, | |
"id": "134", | |
"title": "Skyway Connection", | |
"short_name": "skyway", | |
"full_description": "<p>.<\/p>", | |
"short_description": ".", | |
"Image": false, | |
"image": false, | |
"hosts": [{ | |
"id": "584", | |
"display_name": "Kent", | |
"username": "kent", | |
"image": false | |
}, | |
{ | |
"id": "71", | |
"display_name": "John:D", | |
"username": "JohnD", | |
"image": false | |
}, | |
{ | |
"id": "229", | |
"display_name": "Kupuna Don", | |
"username": "Don", | |
"image": false | |
}], | |
"categories": [] | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment