Created
October 27, 2016 13:21
-
-
Save matdziu/799a35c60c6f77b86cbd94f7ba01cdd5 to your computer and use it in GitHub Desktop.
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 DataDeserializer implements JsonDeserializer<DataModel> { | |
| @Override | |
| public DataModel deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | |
| JsonObject jsonDataObject = json.getAsJsonObject(); | |
| String status = jsonDataObject.get("status").getAsString(); | |
| String sex = jsonDataObject.get("sex").getAsString(); | |
| String surname = jsonDataObject.get("surname").getAsString(); | |
| String name = jsonDataObject.get("name").getAsString(); | |
| int id = jsonDataObject.get("id").getAsInt(); | |
| return new DataModel(status, sex, surname, name, id); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment