json.put("Description", Strings.nullToEmpty(feed.getDescription()));
json.put("Link", Strings.nullToEmpty(feed.getLink()));
//Retrieve the feed image if it is available as well as an image url if the image is available.
if (feed.getImage() != null && !Strings.isNullOrEmpty(feed.getImage().getUrl())) {
SyndImage feedImage = feed.getImage();
JSONObject jsonImage = new JSONObject();
jsonImage.put("Url", feedImage.getUrl());
if (!Strings.isNullOrEmpty(feedImage.getTitle())) {
jsonImage.put("Title", feedImage.getTitle());
}
if (!Strings.isNullOrEmpty(feedImage.getDescription())) {
jsonImage.put("Description", feedImage.getDescription());
}
if (!Strings.isNullOrEmpty(feedImage.getLink())) {
jsonImage.put("Link", feedImage.getLink());
}
json.put("Image", jsonImage);
}