Skip to content

Instantly share code, notes, and snippets.

@akexorcist
Last active July 23, 2016 11:54
Show Gist options
  • Select an option

  • Save akexorcist/0c1e18989829a30aed48724fa6c41151 to your computer and use it in GitHub Desktop.

Select an option

Save akexorcist/0c1e18989829a30aed48724fa6c41151 to your computer and use it in GitHub Desktop.
เฉลยโจทย์ JSON แปลงเป็น Java Class
public class Answer1 {
@SerializedName("status")
private String status;
@SerializedName("message")
private String message;
@SerializedName("brand_list")
private List<String> brandList = new ArrayList<>();
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public List<String> getBrandList() {
return brandList;
}
public void setBrandList(List<String> brandList) {
this.brandList = brandList;
}
}
public class Answer2 {
@SerializedName("customer_data_list")
private List<CustomerDataList> customerDataList = new ArrayList<>();
public List<CustomerDataList> getCustomerDataList() {
return customerDataList;
}
public void setCustomerDataList(List<CustomerDataList> customerDataList) {
this.customerDataList = customerDataList;
}
public static class CustomerDataList {
@SerializedName("id")
private Integer id;
@SerializedName("first_name")
private String firstName;
@SerializedName("last_name")
private String lastName;
@SerializedName("email")
private String email;
@SerializedName("gender")
private String gender;
@SerializedName("ip_address")
private String ipAddress;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
}
}
public class Answer3 {
@SerializedName("responses")
private List<Response> responses = new ArrayList<>();
public List<Response> getResponses() {
return responses;
}
public void setResponses(List<Response> responses) {
this.responses = responses;
}
public class LabelAnnotation {
@SerializedName("mid")
private String mid;
@SerializedName("description")
private String description;
@SerializedName("score")
private Double score;
public String getMid() {
return mid;
}
public void setMid(String mid) {
this.mid = mid;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Double getScore() {
return score;
}
public void setScore(Double score) {
this.score = score;
}
}
public class Response {
@SerializedName("labelAnnotations")
private List<LabelAnnotation> labelAnnotations = new ArrayList<>();
public List<LabelAnnotation> getLabelAnnotations() {
return labelAnnotations;
}
public void setLabelAnnotations(List<LabelAnnotation> labelAnnotations) {
this.labelAnnotations = labelAnnotations;
}
}
}
public class Answer4 {
@SerializedName("status")
private String status;
@SerializedName("geocoded_waypoints")
private List<GeocodedWaypoint> geocodedWaypoints = new ArrayList<GeocodedWaypoint>();
@SerializedName("routes")
private List<Route> routes = new ArrayList<Route>();
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public List<GeocodedWaypoint> getGeocodedWaypoints() {
return geocodedWaypoints;
}
public void setGeocodedWaypoints(List<GeocodedWaypoint> geocodedWaypoints) {
this.geocodedWaypoints = geocodedWaypoints;
}
public List<Route> getRoutes() {
return routes;
}
public void setRoutes(List<Route> routes) {
this.routes = routes;
}
public static class Bounds {
@SerializedName("southwest")
private Southwest southwest;
@SerializedName("northeast")
private Northeast northeast;
public Southwest getSouthwest() {
return southwest;
}
public void setSouthwest(Southwest southwest) {
this.southwest = southwest;
}
public Northeast getNortheast() {
return northeast;
}
public void setNortheast(Northeast northeast) {
this.northeast = northeast;
}
}
public static class Distance {
@SerializedName("value")
private Integer value;
@SerializedName("text")
private String text;
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
public static class Duration {
@SerializedName("value")
private Integer value;
@SerializedName("text")
private String text;
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
public static class GeocodedWaypoint {
@SerializedName("geocoder_status")
private String geocoderStatus;
@SerializedName("place_id")
private String placeId;
@SerializedName("types")
private List<String> types = new ArrayList<>();
public String getGeocoderStatus() {
return geocoderStatus;
}
public void setGeocoderStatus(String geocoderStatus) {
this.geocoderStatus = geocoderStatus;
}
public String getPlaceId() {
return placeId;
}
public void setPlaceId(String placeId) {
this.placeId = placeId;
}
public List<String> getTypes() {
return types;
}
public void setTypes(List<String> types) {
this.types = types;
}
}
public static class Northeast {
@SerializedName("lat")
private Double lat;
@SerializedName("lng")
private Double lng;
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
public Double getLng() {
return lng;
}
public void setLng(Double lng) {
this.lng = lng;
}
}
public static class Route {
@SerializedName("summary")
private String summary;
@SerializedName("step")
private List<Step> step = new ArrayList<>();
@SerializedName("bounds")
private Bounds bounds;
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public List<Step> getStep() {
return step;
}
public void setStep(List<Step> step) {
this.step = step;
}
public Bounds getBounds() {
return bounds;
}
public void setBounds(Bounds bounds) {
this.bounds = bounds;
}
}
public static class Southwest {
@SerializedName("lat")
private Double lat;
@SerializedName("lng")
private Double lng;
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
public Double getLng() {
return lng;
}
public void setLng(Double lng) {
this.lng = lng;
}
}
public static class Step {
@SerializedName("duration")
private Duration duration;
@SerializedName("distance")
private Distance distance;
@SerializedName("start_address")
private String startAddress;
@SerializedName("end_address")
private String endAddress;
public Duration getDuration() {
return duration;
}
public void setDuration(Duration duration) {
this.duration = duration;
}
public Distance getDistance() {
return distance;
}
public void setDistance(Distance distance) {
this.distance = distance;
}
public String getStartAddress() {
return startAddress;
}
public void setStartAddress(String startAddress) {
this.startAddress = startAddress;
}
public String getEndAddress() {
return endAddress;
}
public void setEndAddress(String endAddress) {
this.endAddress = endAddress;
}
}
}
public class Answer5 {
@SerializedName("kind")
private String kind;
@SerializedName("nextPageToken")
private String nextPageToken;
@SerializedName("blog")
private Blog blog;
@SerializedName("items")
private List<Item> items = new ArrayList<>();
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public String getNextPageToken() {
return nextPageToken;
}
public void setNextPageToken(String nextPageToken) {
this.nextPageToken = nextPageToken;
}
public Blog getBlog() {
return blog;
}
public void setBlog(Blog blog) {
this.blog = blog;
}
public List<Item> getItems() {
return items;
}
public void setItems(List<Item> items) {
this.items = items;
}
public static class Author {
@SerializedName("id")
private String id;
@SerializedName("displayName")
private String displayName;
@SerializedName("url")
private String url;
@SerializedName("image")
private Image image;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Image getImage() {
return image;
}
public void setImage(Image image) {
this.image = image;
}
}
public static class Blog {
@SerializedName("id")
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
public static class Image {
@SerializedName("url")
private String url;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
public static class Item {
@SerializedName("kind")
private String kind;
@SerializedName("id")
private String id;
@SerializedName("published")
private String published;
@SerializedName("updated")
private String updated;
@SerializedName("url")
private String url;
@SerializedName("title")
private String title;
@SerializedName("author")
private Author author;
@SerializedName("labels")
private List<String> labels = new ArrayList<>();
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPublished() {
return published;
}
public void setPublished(String published) {
this.published = published;
}
public String getUpdated() {
return updated;
}
public void setUpdated(String updated) {
this.updated = updated;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Author getAuthor() {
return author;
}
public void setAuthor(Author author) {
this.author = author;
}
public List<String> getLabels() {
return labels;
}
public void setLabels(List<String> labels) {
this.labels = labels;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment