Created
November 18, 2015 04:57
-
-
Save GulajavaMinistudio/39dc9a6c9c2a382043eb to your computer and use it in GitHub Desktop.
JacksonJrResponseConverter class for parsing JSON string in the form of JSON Object
This file contains 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
package gulajava.pilkadayuks.internets; | |
import com.fasterxml.jackson.jr.ob.JSON; | |
import com.squareup.okhttp.ResponseBody; | |
import java.io.IOException; | |
import retrofit.Converter; | |
/** | |
* Created by Gulajava Ministudio on 11/18/15. | |
*/ | |
public class JacksonJrResponseConverter<T> implements Converter<ResponseBody, T> { | |
private Class<T> clazz; | |
public JacksonJrResponseConverter(Class<T> tClass) { | |
this.clazz = tClass; | |
} | |
@Override | |
public T convert(ResponseBody value) throws IOException { | |
return JSON.std.beanFrom(clazz, value.bytes()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment