How to define lists in object binded to JSON?

I am trying to create an object to bind the JSON response to my object using Jackson Library but I do not know how to define few of the fileds such as category, neighborhoods, location and address.

Sample response from JSON

{"region": 
            {"span": 
                {"latitude_delta": 0.10262262794520893, "longitude_delta": 0.22282942}, 
                "center": {"latitude": 51.510372893357001, "longitude": -0.1108336}}, 
                "total": 246, "businesses": [{"is_claimed": false, 
                                                "rating": 4.5, 
                                                "mobile_url": "http://m.yelp.co.uk/biz/r-garcia-and-sons-foods-and-wines-of-spain-london", 
                                                "rating_img_url": "http://s3-media2.ak.yelpcdn.com/assets/2/www/img/99493c12711e/ico/stars/v1/stars_4_half.png", 
                                                "review_count": 11, 
                                                "name": "R Garcia \u0026 Sons - Foods and Wines of Spain", 
                                                "snippet_image_url": "http://s3-media2.ak.yelpcdn.com/photo/8xquccU5FKaFg9ZlANdOJA/ms.jpg", 
                                                "rating_img_url_small": "http://s3-media2.ak.yelpcdn.com/assets/2/www/img/a5221e66bc70/ico/stars/v1/stars_small_4_half.png", 
                                                "url": "http://www.yelp.co.uk/biz/r-garcia-and-sons-foods-and-wines-of-spain-london", 
                                                "phone": "+442072216119", 
                                                "snippet_text": "aka R Garcia \u0026 Son, and Cafe Garcia. Although, technically, Cafe Garcia is next door attached to their la carniceria. \n\nIt is a great Spanish grocery store...", 
                                                "image_url": "http://s3-media3.ak.yelpcdn.com/bphoto/t14haXQrAW8HMwc0RTL1jQ/ms.jpg", 
                                                "categories": [["Delis", "delis"], ["Spanish", "spanish"], ["Beer, Wine \u0026 Spirits", "beer_and_wine"]], 
                                                "display_phone": "+44 20 7221 6119", 
                                                "rating_img_url_large": "http://s3-media4.ak.yelpcdn.com/assets/2/www/img/9f83790ff7f6/ico/stars/v1/stars_large_4_half.png", 
                                                "id": "r-garcia-and-sons-foods-and-wines-of-spain-london", 
                ]                               "is_closed": false, 
                                                "location": {"city": "London", "display_address": ["248-250 Portobello Road", "Notting Hill", "London W11 1LL", "UK"], 
                                                "neighborhoods": ["Notting Hill"], 
                                                "postal_code": "W11 1LL", 
                                                "country_code": "GB", 
                                                "address": ["248-250 Portobello Road"], 
                                                "state_code": "XGL"}}, 
                                                {"is_claimed": false, "rating": 3.0, ......

Classes

public class Region {
    private Span span;

    getter and setter
}

public class Span {
    private double latitude_delta;
    private double longitude_delta;
    private Center center;
    private int total;
    private Businesses businesses;

    getter and setter
}


public class Center {
    private double latitude;
    private double longtitude;

    getter and setter 
} 

public class Businesses {
    private boolean is_claimed;
    private double rating;
    private String mobile_url;
    private String rating_img_url;
    private int review_count;
    private String name;
    private String snipper_image_url;
    private String rating_img_url_small;
    private String url;
    private String phone;
    private String snippet_text;
    private String image_url;
    private categories;        <<<<<<<<<<<<<<<<<
    private String display_phone;
    private String rating_img_url_large;
    private String id;
    private boolean is_closed;
    private Location location;     <<<<<<<<
    private neighborhoods          <<<<<<<<<
    private String postal_code;
    private String country_code;
    private address              <<<<<<<<<<
    private String state_code;

    getters and setters
}

Answers


categories: list of lists of starings. You can use array instead of list.

class Location {
    String city;
    String[] displayAddress; // you can use list instead
}

neighborhoods - I cannot see such field in your json.

String[] address; //or list as in previous case.


Need Your Help

ASP.NET 5 RC Web API + Framework 4.6 RC Lib

c# asp.net asp.net-web-api2 visual-studio-2015 .net-4.6

I'm currently testing the Visual Studio 2015 RC and encounter a problem that I'm not able to solve.