package reddit.pojo.processing;
import com.fasterxml.jackson.databind.ObjectMapper;
import reddit.pojo.SubredditJson;
public class SubredditJsonUnmarshaller {
public static SubredditJson unmarshalJson(String jsonResponse) {
ObjectMapper objectMapper = new ObjectMapper();
SubredditJson subredditJson = null;
try {
subredditJson = objectMapper.readValue(jsonResponse, SubredditJson.class);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(String.format("unable to unmarshall json [%s]", jsonResponse));
}
return subredditJson;
}
}